bug-commoncpp
[Top][All Lists]
Advanced

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

Re: Thread problems on Mac OS X


From: David Sugar
Subject: Re: Thread problems on Mac OS X
Date: Wed, 15 Jan 2003 15:06:10 -0500
User-agent: KMail/1.4.3

I suppose we can check errno for ENOSYS and then have it try sem_open instead.  
A naming scheme for generating valid and unique names (perhaps by pid and 
seq) would also need to be used...

On Tuesday 14 January 2003 18:09, Ian Gough wrote:
> While trying out CC++ on Mac OS X, I found a problem that causes CC++ to
> recurse to death.
>
> When creating a Thread object, a Semaphore (joinSem) gets instantiated.
> On this OS, the Semaphore constructor calls sem_init and if this fails,
> calls getException(), which instantiates a Thread, which creates a
> Semaphore, etc, causing the app to blow out the stack.
>
> the following snippet from near line 130 in semaphore.cpp
>
> Semaphore::Semaphore(size_t resource)
> {
>         if(sem_init(&_semaphore, 0, resource))
>         {
>                 if(getException() == Thread::throwObject)
>                         throw(this);
>
> It seems that the sem_init is failing with ENOSYS, which means the
> sem_init function is not implemented on this platform, nor is
> sem_destroy(). It does seem though that sem_open() is implemented.
>
> Perhaps the autotools need to test for correctly operating sem_init (one
> that doesn't return -1 all the time!) and use sem_open() in that case.
>
> Regardless of whether this gets done or not though, the recursion issue
> should probably be addressed, even though it only occurs on a failed
> sem_init() call.





reply via email to

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