D2000 OBJApi - Asynchronous functions (messages)
The asynchronous functions are called by the library ObjApi.dll as messages
during the runtime of client process. A user process must define the handlers
for the following types of messages:
- NewObjectValue message
- A message notifying a change of value (status) of an opened object or a
process child.
- NewDefinition message
- A configuration message notifying the creation of a new child or the
deletion of a process child. After calling the function SendChildren,
a series of these messages, which defines all children of the user process,
is sent to the user process.
When designing handlers, the following facts must be taken into account:
- Function used to handle the messages are called asynchronously from ObjAPI.
It means, that if the functions share some resources with other threads of the
user process, it is necessary to ensure a mutual exclusive access to these
resources within the frame of the user process.
- Messages are processed by this way in series, one after another -
another message can not be processed until handling of one message is finished (NewObjectValue
or NewDefinition). It implies that the messages with a significant
handling period must be processed by independent thread.
- Handlers may not use the ObjAPI functions, which belong to the category
Synchronous. The description of each executive or auxiliary function contains
the information
whether the function is synchronous or asynchronous. The synchronous functions use
a communication channel that is locked in time of handling asynchronous
messages. So, if the functions were called from a message handler, a deadlock
could occur.