Re: Bug#326648: libsqlite3-0: database handles can't be shared among threads any more
* Francesco P. Lovergine:
>> I've looked at the SQLite code and it does this. At the same time, it
>> has to implement recursive locks (which can be entered multiple times
>> by the same locker, hence it embeds a locker ID (the value returned by
>> phtread_self) in the lock data structure. This causes the problem
>> Adeodato described.
>>
>> I don't know how to better implement locking for SQLite, given the
>> constraints.
>>
>
> Wow, you are trying to render thread-safe a non-thread-safe library, man
> if I did understand right the terms of the problem.
SQLite is thread-safe. However, you can't pass database handles from
one thread to the another.
> Two, hints:
>
> - See flockfile() and its sister calls for stdio functions.
The flockfile family of functions has the same problem:
| The `funlockfile' function does not return an error status and the
| behavior of a call for a stream which is not locked by the current
| thread is undefined.
Reply to: