create_conditionT_create_conditionCreateConditionCreateConditioncreate_condition (Operator)
create_conditionT_create_conditionCreateConditionCreateConditioncreate_condition
— Create a condition variable synchronization object.
Signature
void CreateCondition(const HTuple& AttribName, const HTuple& AttribValue, HTuple* ConditionHandle)
void HCondition::HCondition(const HTuple& AttribName, const HTuple& AttribValue)
void HCondition::HCondition(const HString& AttribName, const HString& AttribValue)
void HCondition::HCondition(const char* AttribName, const char* AttribValue)
void HCondition::HCondition(const wchar_t* AttribName, const wchar_t* AttribValue)
(
Windows only)
void HCondition::CreateCondition(const HTuple& AttribName, const HTuple& AttribValue)
void HCondition::CreateCondition(const HString& AttribName, const HString& AttribValue)
void HCondition::CreateCondition(const char* AttribName, const char* AttribValue)
void HCondition::CreateCondition(const wchar_t* AttribName, const wchar_t* AttribValue)
(
Windows only)
def create_condition(attrib_name: MaybeSequence[Union[int, float, str]], attrib_value: MaybeSequence[Union[int, float, str]]) -> HHandle
Description
A condition variable (short: “condition”) is a synchronization
device that allows threads to suspend execution and relinquish the
processors until some predicate on shared data is satisfied. The basic
operations on conditions are: signal the condition (when the predicate
becomes true), and wait for the condition, suspending the thread execution
until another thread signals the condition.
A condition variable must always be associated with a mutex, to avoid
the race condition where a thread prepares to wait on a condition variable
and another thread signals the condition just before the first
thread actually waits on it.
create_conditioncreate_conditionCreateConditionCreateConditioncreate_condition
creates and initializes the condition variable
ConditionHandleConditionHandleConditionHandleconditionHandlecondition_handle
, using the condition attributes specified in
AttribNameAttribNameAttribNameattribNameattrib_name
and AttribValueAttribValueAttribValueattribValueattrib_value
, or default attributes if
AttribNameAttribNameAttribNameattribNameattrib_name
is ''"""""""".
The current implementation supports no
attributes for conditions, hence the AttribNameAttribNameAttribNameattribNameattrib_name
parameter must
be set to ''"""""""".
Execution Information
- Multithreading type: independent (runs in parallel even with exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
AttribNameAttribNameAttribNameattribNameattrib_name
(input_control) number(-array) →
HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)
Mutex attribute.
Default:
[]
AttribValueAttribValueAttribValueattribValueattrib_value
(input_control) number(-array) →
HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)
Mutex attribute value.
Number of elements:
AttribValue == AttribName
Default:
[]
ConditionHandleConditionHandleConditionHandleconditionHandlecondition_handle
(output_control) condition →
HCondition, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Condition synchronization object.
Result
create_conditioncreate_conditionCreateConditionCreateConditioncreate_condition
returns 2 (
H_MSG_TRUE)
if all parameters are correct.
If necessary, an exception is raised.
Possible Successors
wait_conditionwait_conditionWaitConditionWaitConditionwait_condition
,
timed_wait_conditiontimed_wait_conditionTimedWaitConditionTimedWaitConditiontimed_wait_condition
,
signal_conditionsignal_conditionSignalConditionSignalConditionsignal_condition
See also
clear_conditionclear_conditionClearConditionClearConditionclear_condition
Module
Foundation