[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Thread problems on Mac OS X
From: |
Ian Gough |
Subject: |
Thread problems on Mac OS X |
Date: |
Tue, 14 Jan 2003 18:09:56 -0500 |
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.
- Thread problems on Mac OS X,
Ian Gough <=