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

Jonas Bähr jonas.baehr at web.de
Sun Sep 25 12:34:49 UTC 2011


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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sigcatcher-sem_open.cpp
Type: application/octet-stream
Size: 7085 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-freebsd/attachments/20110925/f41313f0/attachment.obj>
-------------- next part --------------



$ g++ -O2 -o sigcatcher-sem_open -pthread sigcatcher-sem_open.cpp
$ ./sigcatcher-sem_open
Hello, World!
Got a result of 1
Exited thread
$

bye,
Jonas

>
> If you want to see the signal handler in action there's a couple of  
> lines you
> can uncomment (just grep for uncomment to find where).
>
> Obviously any other feedback on possible issues is appreciated as  
> well, but
> basically I'd like to catch any portability issues early this time  
> instead of
> after-the-fact.
>
> Please CC me on any replies as I'm not subscribed.
>
> Regards,
> - Michael  
> Pyne<sigcatcher.cpp>_______________________________________________
> kde-mac at kde.org
> List Information: https://mail.kde.org/mailman/listinfo/kde-mac
> KDE/Mac Information: http://techbase.kde.org/index.php?title=Projects/KDE_on_Mac_OS_X



More information about the kde-freebsd mailing list