comp.lang.ada
 help / color / mirror / Atom feed
From: Tomek Walkuski <tomek.walkuski@gmail.com>
Subject: Re: Ada and MySQL (mysql_library_init)
Date: Sun, 6 Dec 2009 05:06:35 -0800 (PST)
Date: 2009-12-06T05:06:35-08:00	[thread overview]
Message-ID: <1f1dd31f-dc98-43b1-9f28-6af11292dd46@h2g2000vbd.googlegroups.com> (raw)
In-Reply-To: da1e9ed5-b8f1-49c8-b0b9-5b065ef94cb1@z7g2000vbl.googlegroups.com

On 6 Gru, 00:03, Maciej Sobczak <see.my.homep...@gmail.com> wrote:
> According to MySQL docs, you do not have to call this function,
> because mysql_init does it implicitly - you have to just ensure that
> you do not call it from multiple threads, which seems straightforward
> as it is an initialization function.
>
MySQL docs say:

"In a nonmulti-threaded environment, the call to mysql_library_init()
may be omitted, because mysql_init()  will invoke it automatically as
necessary. However, mysql_library_init() is not thread-safe in a multi-
threaded environment, and thus neither is mysql_init(), which calls
mysql_library_init(). You must either call mysql_library_init()  prior
to spawning any threads, or else use a mutex to protect the call,
whether you invoke mysql_library_init() or indirectly via mysql_init
(). This should be done prior to any other client library call."

So in multi-threaded environment mysql_library_init CANNOT be ommited.

And how about mysql_library_end() ? I could not import it to Ada and
this function performs some memory clean up after disconnection.



  reply	other threads:[~2009-12-06 13:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-05 22:41 Ada and MySQL (mysql_library_init) Tomek Walkuski
2009-12-05 23:03 ` Maciej Sobczak
2009-12-06 13:06   ` Tomek Walkuski [this message]
2009-12-06 20:49     ` Maciej Sobczak
2009-12-06 21:13       ` Tomek Walkuski
2009-12-06 15:59 ` Stephen Leake
2009-12-06 16:52   ` Tomek Walkuski
2009-12-07  6:55     ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox