[omniORB] omni_thread::join()

Renzo Tomaselli renzo.tomaselli@tecnotp.it
Thu, 2 Mar 2000 14:38:00 +0100


Tom,
        AFAIK there is no solution for Win32. From MSDN I read that the f=
our
global dll life events, e.g. the ones you can process in a DllMain functi=
on
(process/thread attach/detach) are fully *serialized* by the kernel.
This means that if you are inside one of them, such as a static object
destructor called because of a FreeLibrary or alike, and you kill another
thread, you cannot wait for its termination (what NP_destroy does). Doing
that creates a deadlock because of the above serialization. That's the
reason why NP_destroy cannot be used during dll shutdown, unfortunately t=
he
propermost place where to put it.
I would kindly suggest to bracket those joins in NP_destroy by an "#ifdef
WIN32" or to let the caller passing in a flag about whether joining the
killed threads or not.

I have many instances of such background threads in my dlls and the
procedure I adopted is to let them know we are going to die so that they =
can
release any allocated resource; we can wait for such release to terminate=
 so
that just thread termination remains (this is just a matter of playing
around a little with a cond. variable) but we must avoid to join the thre=
ad
afterwards. Then such thread can die on its own without any noticeable
side-effect.
And btw, I'm curious about the same issue on Unix shared libraries; so fa=
r I
have no info about this.
Bye,
                                             Renzo Tomaselli
-------------------------------------------------------------------------=
--
TecnoTP s.n.c. Special Information System Design
Maso Pelauchi I38050 Ronchi Valsugana,  Trento TN  ITALY
Tel. +39 0461 773164      Fax. +39 0461 771514
e-mail: renzo.tomaselli@tecnotp.it
-------------------------------------------------------------------------=
--


-----Original Message-----
From: Eicher Thomas <tei@elca.ch>
To: renzo.tomaselli@tecnotp.it <renzo.tomaselli@tecnotp.it>
Date: gioved=EC 2 marzo 2000 11:51
Subject: Re: [omniORB] omni_thread::join()


Hi Renzo

You have posted in the omniORB mailing list in November about a problem w=
hen
shutting down the ORB using NP_destroy(), which would hang when called fr=
om
a static deinitializer in a dll.

I have encountered the same problem. Since nobody answered you -> Have yo=
u
found a solution?

thanks,
-- tom
______________________________________________
Tom Eicher                  ELCA Informatik AG
tei@elca.ch                    Steinstrasse 21
+41 (0)1 456 32 47                 8003 Z=FCrich
http://www.elca.ch                 Switzerland