From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a36a9db79cd4c60d X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!h2g2000vbd.googlegroups.com!not-for-mail From: Tomek Walkuski Newsgroups: comp.lang.ada Subject: Re: Ada and MySQL (mysql_library_init) Date: Sun, 6 Dec 2009 05:06:35 -0800 (PST) Organization: http://groups.google.com Message-ID: <1f1dd31f-dc98-43b1-9f28-6af11292dd46@h2g2000vbd.googlegroups.com> References: NNTP-Posting-Host: 83.28.68.14 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1260104893 13396 127.0.0.1 (6 Dec 2009 13:08:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 6 Dec 2009 13:08:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: h2g2000vbd.googlegroups.com; posting-host=83.28.68.14; posting-account=Ar5oKAoAAAD4cyp5eTv5CtR88dGtUxxC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; pl-PL; rv:1.9.1.5) Gecko/20091105 Fedora/3.5.5-1.fc12 Firefox/3.5.5,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8321 Date: 2009-12-06T05:06:35-08:00 List-Id: On 6 Gru, 00:03, Maciej Sobczak 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.