bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread (usually) not doing what I'd expect


From: Matt Rice
Subject: Re: Thread (usually) not doing what I'd expect
Date: Tue, 7 Nov 2006 06:44:54 -0800 (PST)


--- Graham J Lee <leeg@thaesofereode.info> wrote:

> Hi all,
> 
> The code below demonstrates the problem I'm seeing
> with gnustep-base  
> 1.13.0 on i386/Linux, where NSThread  
> +detachNewThreadSelector:toTarget:withObject: is not
> consistently  
> executing the method indicated.  I'm trying to
> choose my words  
> carefully here, because it *does* create a new LWP. 
> In fact, if I  
> set a breakpoint at the [NSThread ...] line, I can
> step through  
> NSThread.m and see that objc_thread_dispatch returns
> non-NULL[*].   
> However, the global variable x never gets set and
> none of the NSLog()  
> lines in the -doStuff method appear.  I'm not so
> good with debugging  
> multiple-threaded apps but if I step past
> objc_thread_detach then  
> look at the threads display in ddd, I only see one
> thread, although I  
> do get a notification of a new LWP from the
> debugger.
> 
> It looks like it might be racy, because if I step
> past the section  
> (lines 551-555 here, I'm on base 1.13.0) in
> NSThread.m:
>    if
>
(objc_thread_detach(@selector(__sendThreadMethod),thread,nil)
>  
> == NULL)
>      {
>        [NSException raise:
> NSInternalConsistencyException
>                    format: @"Unable to detach thread
> (unknown error)"];
>      } // <--step to here
> }

this little trouble maker looks awfully familiar

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18573

it could be that 0 is a valid thread id in whichever
threading model your libobjc is compiled with

this was the case on hurd/posix threads, but they
changed the first thread to 1 i believe




 
____________________________________________________________________________________
Sponsored Link

Try Netflix today! With plans starting at only $5.99 a month what are you 
waiting for?
http://www.netflix.com/Signup?mqso=80010030




reply via email to

[Prev in Thread] Current Thread [Next in Thread]