Original question:
> Digital UNIX 4.0D, DCE 3.1.
>
> Developing DCE RPC enabled program implies that I forced to use POSIX
> 1003.4a/d4 threads interfaces (-threads linker option).
>
> Is there any way to use POSIX 1003.1c interfaces in such applications? In
> particular I would like to use pthread_rwlock_*.
and irrefragable answer from David Butenhof <David.Butenhof_at_compaq.com>:
There's no problem mixing the DCE thread and POSIX thread interfaces within
the same program. The only restriction is that you can't use both within
the same file. (I.e., you can't include both the real <pthread.h> and
<dce/pthread.h>... and any file compiled with -threads will cause
<pthread.h> to "chain" to <dce/pthread.h>.)
If there are any DCE-based interfaces you use that export or import
"objects" from the thread API, such as pthread_t, pthread_mutex_t, or so
forth, you also have to be careful because while the type names are the
same the STRUCTURE of those types is very different. They're not
interchangeable. Still, DCE thread code that happens to be running in a
POSIX thread can synchronize using DCE thread mutexes; and your POSIX code
could use the POSIX rwlock interfaces in a thread created using DCE
pthread_create().
DCE thread operations can operate on POSIX threads (and vise versa) as long
as they can get (or have been given) the proper type of pthread_t for the
thread. A DCE library can use the DCE thread pthread_self() to get a DCE
pthread_t for a thread created using POSIX pthread_create(), for example,
and change its priority. But if given the POSIX pthread_t, it'll blow up
ungracefully.
--
Rustam Usmanov, systems engineer
Open Library Systems Center, St.Petersburg State Technical University
Address: 29, Politekhnitcheskaya str., St.Petersburg, 195251, Russia
Tel/fax: +7 812 552 7654 <URL:http://www.unilib.neva.ru/olsc/>
Received on Thu Oct 04 2001 - 13:45:37 NZST