[Top][All Lists]

[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 <address@hidden> 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
> == NULL)
>      {
>        [NSException raise:
> NSInternalConsistencyException
>                    format: @"Unable to detach thread
> (unknown error)"];
>      } // <--step to here
> }

this little trouble maker looks awfully familiar


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?

reply via email to

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