Omnithread

Tristan Richardson tjr@orl.co.uk
Tue, 27 May 1997 15:02:05 +0100


Hi Brian,

Thanks for your comments regarding the OMNI thread library.

>
> I'm porting the omnithread library to BeOS (http://www.be.com) and
> noticied that there are no classes in the omnithread.h file for
> acquiring and releasing mutexes and semaphores.  These really should be
> added since they would be far more convenient and less error prone than
> calling lock()/unlock() directly.
>

You're right that classes like these would be useful.  The reason they're not
included is simply that the omnithread library was one of the first pieces of
C++ code I ever wrote (this was several years ago!).  If you look at the
omniNames source in "ReadersWritersLock.h" you'll see I use the same trick
that you suggest.


>
> I noticed that omnithread does not use exceptions to report errors.  Is
> this a deliberate design decision?  If not, I'd like to propose that the
> classes be modified to report errors using exceptions.
>
> I think this would greatly improve the interface.  For example,
> omni_condition::timed_wait() could simply return a bool (TRUE if
> signalled, FALSE if timed out) and throw an exception if some error
> prevented completion of the call.
>

Again this is because omnithread was written quite a while ago, before
exceptions were commonplace, and we wanted it to be as widely portable as
possible.  However, given that omniORB2 requires that the C++ compiler
supports exceptions it would indeed improve the omnithread interface to make
use of this fact.

We will almost certainly add these features in the next release of omniORB2. 
However, we must of course be careful about changing fundamental APIs like
this which may potentially break existing code.


Thanks again for your comments.


Tristan



+--------------------------------------------------------------------+
|  Tristan Richardson                 Email:  tjr@orl.co.uk          |
|  ORL                                  Tel:  +44 1223 343000        |
|  24a Trumpington Street               Fax:  +44 1223 313542        |
|  Cambridge, CB2 1QA, UK               WWW:  http://www.orl.co.uk/  |
+--------------------------------------------------------------------+
|          ORL - The Olivetti & Oracle Research Laboratory           |
+--------------------------------------------------------------------+