You're right!

I checked the Solaris documentation the correct flag to compile
multithread program is -D_REENTRANT.

I have reconfigured and remade sqlite libs:
  ./configure --enable-threadsafe CFLAGS=-D_REENTRANT
  make

I have remade my test file ...and it is working well now!
Thanks you very much!!!

Another question: Why ./configure doesn't set itself this flag when I
use --enable-threadsafe in a Solaris system?

Regards,

Sylvain

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dan Kennedy
Sent: Thursday, February 03, 2011 5:15 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Multithreading problem

On 02/03/2011 11:00 PM, Tiberio, Sylvain wrote:
> Here the modification in sqlite3.c:
>
>     if( unlink(zPath)==(-1)&&  errno!=ENOENT ){
>       perror(zPath);
>       return SQLITE_IOERR_DELETE;
>     }
>
> And here is the result:
>
> /home/tiberio/perso/source/sql/bug/try.db-wal: No such file or
directory

That error message suggests that errno should be set to ENOENT.
And when you used the main thread to do the work it seems like
it was, since you didn't get the error then.

Do you have to do something special in Solaris to get errno
to work in multi-threaded apps? Something like
-D_POSIX_C_SOURCE=199506L or -mt perhaps?

Is SQLite being compiled with the same thread-related switches as
the rest of the app?

Dan.



>
> Sylvain
>
> -----Original Message-----
> From: sqlite-users-boun...@sqlite.org
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dan Kennedy
> Sent: Thursday, February 03, 2011 4:51 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Multithreading problem
>
> On 02/03/2011 10:22 PM, Tiberio, Sylvain wrote:
>>
>> Dan,
>>
>> Thanks for your attention.
>>
>> sqlite3_extended_errcode() return 0xA0A that means
> SQLITE_IOERR_DELETE.
>
> Earlier versions of SQLite ignored the return code of unlink(). That
> is probably why you're not seeing a problem with 3.6.22.
>
> Search the code for a function called "unixDelete". In sqlite3.c if
> you are using the amalgamation, os_unix.c otherwise. Near the top
> of that function is this:
>
>     if( unlink(zPath)==(-1)&&  errno!=ENOENT ){
>       return SQLITE_IOERR_DELETE;
>     }
>
> That's where your error is coming from. If you can put a call to
> perror() or print the value of errno just before SQLITE_IOERR_DELETE,
> it might show why that call to unlink() is failing. Printing out
> "zPath" as well is probably a good idea.
>
> Dan.
>
>
>
>
>>
>> Here are others information:
>> - My problem occurs in Sparc/Solaris 10 system.
>> - After my program error, the file try.db exists and has the correct
>> right -rw-r--r--, correct owner/group and a null size.
>>
>> Regards,
>>
>> Sylvain
>>
>> -----Original Message-----
>> From: sqlite-users-boun...@sqlite.org
>> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dan Kennedy
>> Sent: Thursday, February 03, 2011 3:16 PM
>> To: sqlite-users@sqlite.org
>> Subject: Re: [sqlite] Multithreading problem
>>
>> On 02/02/2011 09:31 PM, Tiberio, Sylvain wrote:
>>> Hi!
>>>
>>>
>>>
>>> I have a problem when I try to create a new database in a thread and
>> try
>>> to add a table on it.
>>>
>>>
>>>
>>> The following C code (see in the end of this e-mail) produces:
>>
>> The program is working Ok with 3.7.5 here.
>>
>> After the IO error in sqlite3_exec(), what value does
>> sqlite3_extended_errcode() return?
>>
>> Dan.
>>
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to