Re: [sqlite] getpid() and linux threads in sqlite
Hello, "Mrs. Brisby" <[EMAIL PROTECTED]> 03/06/2004 01:37 PM To: Daniel K <[EMAIL PROTECTED]> cc: [EMAIL PROTECTED] Subject: Re: [sqlite] getpid() and linux threads in sqlite > On Wed, 2004-06-02 at 01:53, Daniel K wrote: > > The getpid() call on my Redhat9 linux box is causing > > some trouble for SQLite. It's reasonably complicated, > > but SQLite currently assumes that on linux the > > getpid() function returns a different value in > > different threads. > Anyway, it shouldn't cause any harm. SQLite only uses the pid to help > work around problems with fcntl-locking (esp. when using NFS) and to > seed the random number generator. I believe the software Mr K is working on is sqlite version 3, and that it is file locking issues he's looking into. Benjamin. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [sqlite] getpid() and linux threads in sqlite
Hello Dan, list Here are the results for Mandrake 10: Linux linux.local 2.4.25-2mdk #1 Tue Mar 2 07:39:08 CET 2004 i686 unknown unknown GNU/Linux pid is 2363 pid is 2363 pid is 2363 pid is 2363 pid is 2363 Linux linux.local 2.6.3-4mdk #1 Tue Mar 2 07:26:13 CET 2004 i686 unknown unknown GNU/Linux pid is 2091 pid is 2091 pid is 2091 pid is 2091 pid is 2091 -- Best regards, Nemanjamailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [sqlite] getpid() and linux threads in sqlite
Hi Dainel, From: "Daniel K" <[EMAIL PROTECTED]> > The getpid() call on my Redhat9 linux box is causing > some trouble for SQLite. It's reasonably complicated, > but SQLite currently assumes that on linux the > getpid() function returns a different value in > different threads. Not so for my setup! > The reason that getpid() on some systems returns the same pid for all threads in a process and differenct pids for each thread on another system is because different thread implementations are used. Different platforms use different thread implementations - you cannot even be sure that different linux distros use the same thread implementation and it may even change between releases of the same distro... You should always use pthread_self() to obtain (per process) unique identifiers for your threads. You can read more here: http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html /Uffe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [sqlite] getpid() and linux threads in sqlite
Daniel K wrote: Hi, The getpid() call on my Redhat9 linux box is causing some trouble for SQLite. It's reasonably complicated, but SQLite currently assumes that on linux the getpid() function returns a different value in different threads. Not so for my setup! The attachment is a program to test this. If a few kind people with linux boxes could compile, run and send me the results of it that would help me out. To compile do: $ gcc -pthread tst_getpid.c -o tst_getpid It will take a few seconds to print out 5 lines of the form "pid is XXX". I need to know whether or not all 5 XXX numbers are the same or distinct. Please include the output of command 'uname -a' and your distro if you can do this. Thanks enormously, Dan. Linux 2.6.4-54.5-default #1 Fri May 7 21:43:10 UTC 2004 i686 i686 i386 GNU/Linux pid is 5779 pid is 5779 pid is 5779 pid is 5779 pid is 5779 Linux 2.6.5-gentoo-r1 #3 Wed May 26 01:51:52 UTC 2004 i686 AMD Duron(tm) processor AuthenticAMD GNU/Linux pid is 17985 pid is 17986 pid is 17987 pid is 17988 pid is 17989 Different results! regards Marcel http://www.xmlBlaster.org __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ #include #include #include void *thread_main(void *pArg){ printf("pid is %d\n", getpid()); sleep(10); } int main(int argc, char **argv){ pthread_t thread; int i; for( i = 0; i < 5 ; i++ ){ pthread_create(, 0, thread_main, 0); sleep(1); } return 0; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sqlite] getpid() and linux threads in sqlite
Hi, The getpid() call on my Redhat9 linux box is causing some trouble for SQLite. It's reasonably complicated, but SQLite currently assumes that on linux the getpid() function returns a different value in different threads. Not so for my setup! The attachment is a program to test this. If a few kind people with linux boxes could compile, run and send me the results of it that would help me out. To compile do: $ gcc -pthread tst_getpid.c -o tst_getpid It will take a few seconds to print out 5 lines of the form "pid is XXX". I need to know whether or not all 5 XXX numbers are the same or distinct. Please include the output of command 'uname -a' and your distro if you can do this. Thanks enormously, Dan. __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ #include #include #include void *thread_main(void *pArg){ printf("pid is %d\n", getpid()); sleep(10); } int main(int argc, char **argv){ pthread_t thread; int i; for( i = 0; i < 5 ; i++ ){ pthread_create(, 0, thread_main, 0); sleep(1); } return 0; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]