[kde-freebsd] [KDE/Mac] [CODE] Multithreaded SIGSEGV signal handling, please examine

Kurt Hindenburg kurt.hindenburg at gmail.com
Sun Sep 25 13:26:03 UTC 2011


On Sep 25, 2011, at 8:34 AM, Jonas Bähr wrote:

> Hi,
> 
> Am 25.09.2011 um 01:37 schrieb Michael Pyne:
> 
>> [...]
>> With that said I don't think the code uses as many POSIX options as the rest
>> of KSharedDataCache (e.g. process-shared mutexes as unimplemented on Mac OS X)
>> but I wanted to give a chance for you guys to test the prototype code
>> beforehand and let me know if there's problems.
>> 
>> You'll want to compile with something like this:
>> $CXX -O2 -o sigcatcher -lrt -pthread sigcatcher.cpp
> 
> Here is the first issue: librt doesn't exist here (Mac OS X 10.5 "Leopard").
> However, the code compiles without the "-lrt".
> $ g++ -O2 -o sigcatcher -pthread sigcatcher.cpp
> $ g++ --version
> i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
> 
>> Make sure optimization is enabled to ensure volatile is used where it's
>> needed. Assuming everything works right you should get output like:
>> 
>> $ ./sigcatcher
>> Hello, World!
>> Got a result of 1
>> Exited thread
>> $
> 
> The next problem is, that sem_init(..) isn't implemented here.
> $ ./sigcatcher
> Error: sem_init: Function not implemented
> $
> 
> It seems that only named semaphores are implemented.
> I've changed this part of your code to use sem_open(..) instead [see attachment] and then I get the expected result:
> <sigcatcher-sem_open.cpp>
> 
> 
> $ g++ -O2 -o sigcatcher-sem_open -pthread sigcatcher-sem_open.cpp
> $ ./sigcatcher-sem_open
> Hello, World!
> Got a result of 1
> Exited thread
> $

Same results as Jonas on Lion.

i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)

Kurt




More information about the kde-freebsd mailing list