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>

next in thread | raw e-mail | index | archive | help
--nextPart1539227.jaYu3Q9KHh
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I finaly converted one of my c++ threading app from pthread alone to=20
commoncpp.  I've subjectively compared the 'before' and 'after' to see whic=
h=20
was more advantageous for me (as in good 'ol pthread or commoncpp library).=
=20

The result is a disappointment.

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

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

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

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

5. Coding with commoncpp is actual more simple that directly using -lpthrea=
d. =20
Good.

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

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

--nextPart1539227.jaYu3Q9KHh
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQBDiIYs4wTBlvcsbJURApEUAKCnxSse65SCY8Jf3O4qZ9WfMovn0QCguxyp
x+biSek8AX+dms0Plv0BRlA=
=MwvZ
-----END PGP SIGNATURE-----

--nextPart1539227.jaYu3Q9KHh--



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