New omnithread library

Tristan Richardson tjr@orl.co.uk
Mon, 16 Jun 1997 13:00:18 +0100


In response to overwhelming demand (:-)) there is a new version of the
omnithread library with several improvements.  The new library will be
included with the next release of omniORB2, scheduled for early next week.

For those who are interested, the changes are as follows:

  * Exceptions are now used everywhere.  Most functions which previously
    returned an error number now return void.  Nearly all such errors were
    unrecoverable and it was never really practical to test the return code
    anyway.  In the new interface functions throw a "fatal" exception when
    they get an underlying system error, or throw an "invalid" exception
    when invoked with invalid arguments.

  * The only such functions which do not return void are the condition
    variable timedwait and semaphore trywait.  As well as potentially
    throwing the above exceptions, these functions now return true on
    success, false on failure.  Because there is no change in function
    signature, the names of the functions have been changed by removing the
    underscore.  This causes existing code which uses them to fail to
    compile, thus ensuring that it be updated to the new interface.  The
    new names are also more similar to the equivalent posix functions.

  * There are new "lock" classes for acquiring mutexes and semaphores.
    These can be used to safely grab a lock until the end of a function,
    releasing it automatically even in the event of exceptions being
    thrown.

  * The implementation "wrapper" functions have been fixed so that they
    should now work properly on all compilers.

  * Some historical baggage has been removed.


The omniORB library recompiles with the new omnithread interface without
modification.  A very minor change is needed to omniNames.  The only
changes likely to be needed to other existing code is where
omni_condition::timed_wait and omni_semaphore::try_wait are used.

Use of exceptions and the new lock classes actually makes the source for
the implementations of omnithread about 30-40% smaller - always a good
sign!

Thanks are due to Brian Burton for suggesting most of these changes.


Happy threading!


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           |
+--------------------------------------------------------------------+