Content-type: text/html
The D language supports a number of dynamic programming extensions to ANSI-C including
dynamic functions (which are have strong dynamic type checking and brokering). Dynamic
functions are translated into equivalent PUPS-ANSI C
orifice
functions which may be dynamically attached to
running
PUPS/PSRP applications via the
psrp(1)
client.
In addition to dynamic functions, the D language also provides support for threads. When a D source is converted to PUPS-ANSI C it is automatically made threadsafe as a part of the conversion process. Functions are analysed to see if they are threadsafe. If they are not, pc2c(1) automatically inserts mutexes to make sure that unsafe functions cannot be simultaneously accessed by more than one thread. The D language extensions also provide language level supports for the notion of a root thread (e.g. the thread running when main() is called) and a set of root thread functions which may only be called by the root thread, and threadsafe functions which may be called by any thread without side effects.
_DLL_ORIFICE:
specifies a function is exportable to running PUPS/PSRP applications via the
PUPS orifice protocol.
_ROOTTHREAD:
specifies a function is only runnable by the
root thread
(e.g. the first thread run by a process).
_THREADSAFE:
specifies that a function is threadsafe (and can therefore be called from any thread within a
process without side effects). Threadsafe functions do not have mutexes automatically inserted
by
pc2c(1)
_TKEY(keytable)
defines the current
keytable
used with the
_TKEY_BIND,
and
_TKEY_FREE
directives.
_TKEY_BIND(key)
specifies than the item
key
is to be bound into the current keytable.
_TKEY_FREE(key)
specifies than the item
key
is to be removed from the current keytable.
pc2c(1)
also checks the syntax of other PUPS-ANSI language extensions (e.g. _PROTOTYPE, _PRIVATE,
_PUBLIC etc.). If an error is found during syntax checking, the offending line is printed
out with its line number, and conversion is aborted.
_USE_FMUTEX(mutex): defines the name of the current mutex.
_TKEY(keytable): define current keytable.
_TKEY_BIND(item): inserts item into current keytable.
_TKEY_FREE(item): removes item from current keytable.
_LOCK_THREAD_FMUTEX(mutex): lock mutex.
_UNLOCK_THREAD_FMUTEX(mutex): unlock mutex.
None.