[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: threads question
- To: guy keren <choo(at-nospam)actcom.co.il>
- Subject: Re: threads question
- From: Oleg Goldshmidt <ogoldshmidt(at-nospam)computer.org>
- Date: 27 Nov 2001 10:25:13 +0200
- Cc: linux-il(at-nospam)linux.org.il
- Delivered-To: linux.org.il-linux-il@linux.org.il
- In-Reply-To: guy keren's message of "Mon, 26 Nov 2001 23:53:58 +0200 (EET)"
- Organization: Speaking for myself only.
- Original-Sender: ogoldshmidt@computer.org
- References: <Pine.GSU.4.30_heb2.09.0111262348240.2530-100000@actcom.co.il>
- Reply-To: linux-il(at-nospam)linux.org.il
- Sender: oleg(at-nospam)data-zoo.com
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
- User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Cuyahoga Valley)
guy keren <choo@actcom.co.il> writes:
> the fact that in this specific code you didn't have a problem, does not
> prove it is correct. the debugger can only be used to show when you _do_
> have a race condition - it cannot be used to prove there is _no_ race
> condition.
No argument here. I did say Nadav was right, I only pointed out that
it was not the cause of the problem - I tried his suggestion.
> > Besides, return from main(), as well as any exit(), should
> > terminate the process (including any threads), freeing the memory by
> > independent means, not execute the rest of the code, buggy as it may
> > be.
>
> not true at all. the main thread is just a thread. when it calls exit(),
> the other threads may still be executing, and theoretically, there could
> be a context switch in the middle of the exit() function, and this might
> cause a race.
Theoretically. Actually, I was quoting Stevens, whom I thought to be a
reliable source, but now I am not so sure (see below)...
> when you handle multi-threading, you are not allowed to say "it won't
> happen"
This is not specific to multithreading.
> as for the bug itself - you are not allowed to pass a NULL pointer as the
> first parameter of pthread_create()
To tell you the truth, I was counting on you, choo, specifically, when
posting the message ;-). This solved the problem indeed. I did not invent
passing a NULL pointer to pthread_create() - I lifted it from UNP as
well. Apparently the thread library became less permissive since then.
Thanks to everybody: choo, Nadav, Omer.
--
Oleg Goldshmidt | ogoldshmidt@NOSPAM.computer.org
"If it ain't broken, it has not got enough features yet."
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il