List:MySQL++« Previous MessageNext Message »
From:Michael Date:May 15 2009 12:55pm
Subject:Re: Segfault using thread_start
View as plain text  
Warren Young wrote:
> On May 14, 2009, at 7:12 PM, Michael wrote:
> 
>> it seems like thread_start is not calling mysql_init implicitely, so
>> calls to mysqlpp::tgread_start result in a segfault (mysql++ 3.08 on
>> FreeBSD7.2).
>> Adding
>> mysqlpp::Connection() to the beginning of main works as a temporary fix,
>> but I think thread_start should somehow verify that mysql_(library)_init
>> is called at least once.
> 
> Such details are best left to the underlying C library.  The right fix,
> already scheduled for v3.1, is to expose mysql_library_init() and
> mysql_library_end() through DBDriver.  This will also squish the last
> spurious memory leak report from tools like valgrind when using threads.
> 

Hmm, the underlying C library documentation states, that
mysql_library_init has to be called before any other mysql* function
call. So your solution would be making the user explicitely call it
through DBDriver? I personally feel that it would be much more user
friendly, if mysqlpp would do the bookkeeping automatically (at least
configurable), so users won't need do a C-style init/uninit procedure in
their code (in the end mysqlpp _is_ an abstraction of the plain C library).

Whatever the solution will look like, it might me good to upgrade the
documentation and point that out in the multithreading chapter of
mysqlpp. Depending on the execution path, segfaults might hitting users
unexpectetly.
Thread
Segfault using thread_startMichael15 May
  • Re: Segfault using thread_startWarren Young15 May
    • Re: Segfault using thread_startMichael15 May
      • Re: Segfault using thread_startWarren Young15 May
        • Re: Segfault using thread_startMichael15 May
        • Re: Segfault using thread_startWarren Young15 May
          • Re: Segfault using thread_startMichael15 May
            • Re: Segfault using thread_startWarren Young15 May
              • Re: Segfault using thread_startMichael15 May