From owner-freebsd-threads@FreeBSD.ORG Sat Nov 26 15:58:48 2005 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7AC9C16A41F for ; Sat, 26 Nov 2005 15:58:48 +0000 (GMT) (envelope-from nb_root@videotron.ca) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id B875743D77 for ; Sat, 26 Nov 2005 15:58:38 +0000 (GMT) (envelope-from nb_root@videotron.ca) Received: from clk01a ([66.130.198.54]) by VL-MO-MR001.ip.videotron.ca (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTP id <0IQK00M5QKDPKL30@VL-MO-MR001.ip.videotron.ca> for freebsd-threads@freebsd.org; Sat, 26 Nov 2005 10:58:37 -0500 (EST) Date: Sat, 26 Nov 2005 10:58:22 -0500 From: Nicolas Blais To: freebsd-threads@freebsd.org Message-id: <200511261058.36922.nb_root@videotron.ca> MIME-version: 1.0 Content-type: multipart/signed; boundary=nextPart1539227.jaYu3Q9KHh; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-transfer-encoding: 7bit User-Agent: KMail/1.8.3 Subject: commoncpp vs pthread (was: c++ with pthread?) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Nov 2005 15:58:48 -0000 --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--