Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Nov 2005 10:58:22 -0500
From:      Nicolas Blais <nb_root@videotron.ca>
To:        freebsd-threads@freebsd.org
Subject:   commoncpp vs pthread (was: c++ with pthread?)
Message-ID:  <200511261058.36922.nb_root@videotron.ca>

index | next in thread | raw e-mail

[-- Attachment #1 --]
I finaly converted one of my c++ threading app from pthread alone to 
commoncpp.  I've subjectively compared the 'before' and 'after' to see which 
was more advantageous for me (as in good 'ol pthread or commoncpp library). 

The result is a disappointment.

With commoncpp:
===========
1. Poorly documented. -> 
http://www.gnu.org/software/commoncpp/docs/refman/html/class_posix_thread.html 
(yes it's a 404)

2. Thread::getThreadId(void) exists in the documentation, but does not 
appently exists in cc++/thread.h, so a call to it fails build.  
getPthreadId(void) is there.

3. SIGSEGV when calling delete->this in a thread's destructor.  In fact, 
commoncpp will SIGSEGV it's own simple test program, thread2.cpp.  (gdb: 
death @ ost::Thread::close ()).  A bug report was sent to the developper 2 
weeks ago.  Whether this is a FreeBSD problem or a commoncpp problem is 
unknown.

4. From what I understand, Thread::join will unblock when a thread correctly 
exits and clean, which will never happen because of #3.  My app relies on 
threads joining.  From experience, if I remove delete->this from my thread's 
Final() call, the thread will never unblock and the app forever waits.  If I 
leave delete->this (as recommended by the docs), it will SIGSEGV.

5. Coding with commoncpp is actual more simple that directly using -lpthread.  
Good.

So I went back to faithful -lpthread with my C++ apps.  I believe commoncpp 
can be a good threading library, but it is currently not at that state yet. I 
haven't tested the many other features of commoncpp.

Nicolas.
-- 
FreeBSD 7.0-CURRENT #1: Sat Nov 19 12:36:29 EST 2005     
root@clk01a:/usr/obj/usr/src/sys/CLK01A 
PGP? (updated 16 Nov 05) : http://www.clkroot.net/security/nb_root.asc

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQBDiIYs4wTBlvcsbJURApEUAKCnxSse65SCY8Jf3O4qZ9WfMovn0QCguxyp
x+biSek8AX+dms0Plv0BRlA=
=MwvZ
-----END PGP SIGNATURE-----
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511261058.36922.nb_root>