[omniORB] Ctor/Dtor omni_thread::init_t called per module ???

Sai-Lai Lo S.Lo@uk.research.att.com
26 Apr 1999 19:13:50 +0100


>>>>> Rosimildo DaSilva writes:

> Is there any reason why th instance below is instantiated in a header file:
> omnithread.h
> Its global Ctor is invoked for every module that includes omnithread.h

> static omni_thread::init_t omni_thread_init;

> Why not move this to posix.cc ? and get the Ctor called only once.

It was deliberately done this way to ensure that omnithread library is
initialised before any global initialisers are called. If one move this to
posix.cc, there is no way to ensure that a global initialiser that uses the
omnithread library will not be called before the library is initialised.

Sai-Lai


-- 
Sai-Lai Lo                                   S.Lo@uk.research.att.com
AT&T Laboratories Cambridge           WWW:   http://www.uk.research.att.com 
24a Trumpington Street                Tel:   +44 223 343000
Cambridge CB2 1QA                     Fax:   +44 223 313542
ENGLAND