MySQL embedded and pthreads

Edward Hades edward.hades at gmail.com
Tue Jul 29 08:32:12 CEST 2008


On Tue, Jul 29, 2008 at 7:39 AM, Ian Monroe <ian at monroe.nu> wrote:
> On Mon, Jul 28, 2008 at 3:17 PM, Edward Hades <edward.hades at gmail.com>
> wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi, guys!
>>
>> As you possibly know, I've been working on MySQLe integration with
>> Amarok. I have encountered several issues.
>>
>> First, MySQLe needs patching.
>
> That isn't really acceptable. We need to be able to depend on the distro
> provided packages.
>
True, but it's build-only dependency. And if the two latter issues
(key length and exit) are bearable, I am not quite sure if non-fPIC
code can be used in shared libraries on every platform we target.

>>
>> I'll make a build script to simplify life for us, but
>> packaging questions will remain (luckily it's a build-dep only, so this
>> is not hard to settle).
>
> Why is it a build-only dep? Maybe I'm misunderstanding something.
It's a static library (libmysqld.a).

>
>> Also, there is a thread safety issue. MySQL requires every thread to
>> invoke certain procedures (mysql_thread_init and mysql_thread_end)
>> before accessing its data and before death respectively. I've done some
>> street pthread magic that takes care of initialization, but I still
>> didn't come up with a way to run mysql_thread_end before thread exit.
>
> Yea pthread isn't portable and shouldn't be used directly really.
>
> Just an off-my-top, didn't-look-at-code idea:
> You could use QThread::currentThread() to see if the current thread has been
> initialized or not, and do so in the sqlcollection itself if it needs to be.
>
> That doesn't solve the uninitialized issue...
>
> Seems like the only solution is to explictly call the mysqle uninitalize
> code when the thread is being deleted. This might not be that hard, its
> quite possible only the sqlcollection's querybuilders threads access it
> (outside of the gui thread).
>
Thanks, I'll look into it.


More information about the Amarok-devel mailing list