
Description of the DP Functions, Data, and Error Codes
DP Base Programming Interface for CP 5613/CP 5614
112
C79000-G8976-C108-01
4.1.22 DP_init_sema_object
Purpose
This function initializes a semaphore for an event from the CP 5613/CP 5614 .
With Win32 API functions (WaitForMultipleObjects, WaitForSingleObject,
MsgWaitForMultipleObjects), a user program can wait at these semphores until an
event arrives.
Semaphores are synchronization objects that Win32 API interface also supports.
Using semaphores, it is possible to wait for the arrival of events in threads or
processes.
Note 1
If you want to use semaphores for CP 5614 master and slave modes at the same
time, initialize a master semaphore of the type DP_OBJECT_TYPE_ASYNC with
the user handle of the DP_open call and then initialize a further semaphore of the
type DP_OBJECT_TYPE_ASYNC but with the user handle of the DPS_open call.
Note 2
A semaphore initialized with DP_init_sema_object must only be deleted with the
DP_delete_sema_objet function. Never use Win32 API functions to delete such
semaphores.
Syntax
DPR_DWORD DP_init_sema_object(
DPR_DWORD user_handle, // in
DPR_DWORD sema_type, // in
DPR_DWORD *sema_handle, // out
DP_ERROR_T *error); // out
Komentarze do niniejszej Instrukcji