[omniORB] linux/gdb and multithreading

bjornw@fairplay.no bjornw@fairplay.no
18 Nov 1998 21:25:42 +0100


Digging into the implementation of pthread_cond_timedwait() in glibc-2.0.=
7.27(and 99)
it looks like pthread_cond_timedwait() returns EINTR. However, according =
to
the specification of pthread_cond_timedwait() it shall NOT break due to E=
INTR.

I'll try to modify the glibc-code, but maybe the maintainer (Mr Lu) can g=
et in touch
with some glibc-hacker gurus and get it fixed :-)

bjornw@fairplay.no writes:
>=20
> I'm having problem debugging my multithreaded orb using RedHat-5.1 (and=
 RedHat 5.2).
> My debugger supports multi-threading (gdb-4.17.0.4 from RedHat).
>=20
> Here is whats happening:
>=20
> In the file src/lib/omnithread/posix.cc, in the function timedwait I ge=
t
> a EINTR from pthread_cond_timedwait(), and this leads to omniorb throwi=
ng
> an exception.
>=20
> The question is: why do I get an EINTR? And why does this only happen f=
rom
> within the debugger? My programs runs fine without the debugger.=20
>=20
> int
> omni_condition::timedwait(unsigned long secs, unsigned long nanosecs)
> {
>     timespec rqts =3D { secs, nanosecs };
>=20
>     int rc =3D ERRNO(pthread_cond_timedwait(&posix_cond,
> 					  &mutex->posix_mutex, &rqts));
>     if (rc =3D=3D 0)
> 	return 1;
>=20
> #if (PthreadDraftVersion <=3D 6)
>     if (rc =3D=3D EAGAIN)
> 	return 0;
> #endif
>=20
>     if (rc =3D=3D ETIMEDOUT)
> 	return 0;
>=20
>     throw omni_thread_fatal(rc);
> }
>=20
> bjornw>
> -------------------------------------------------------
> Bj=F8rn Wennberg              email: bjornw@fairplay.no=20
>                                ms: +47 950 82 657
> Senior Programmer           phone: +47 22405538
> FairPlay International AS     fax: +47 22405539