create_barrierT_create_barrierCreateBarrierCreateBarriercreate_barrier (Operator)
Name
create_barrierT_create_barrierCreateBarrierCreateBarriercreate_barrier
— Create a barrier synchronization object.
Signature
void CreateBarrier(const HTuple& AttribName, const HTuple& AttribValue, const HTuple& TeamSize, HTuple* BarrierHandle)
void HBarrier::HBarrier(const HTuple& AttribName, const HTuple& AttribValue, Hlong TeamSize)
void HBarrier::HBarrier(const HString& AttribName, const HString& AttribValue, Hlong TeamSize)
void HBarrier::HBarrier(const char* AttribName, const char* AttribValue, Hlong TeamSize)
void HBarrier::HBarrier(const wchar_t* AttribName, const wchar_t* AttribValue, Hlong TeamSize)
(
Windows only)
void HBarrier::CreateBarrier(const HTuple& AttribName, const HTuple& AttribValue, Hlong TeamSize)
void HBarrier::CreateBarrier(const HString& AttribName, const HString& AttribValue, Hlong TeamSize)
void HBarrier::CreateBarrier(const char* AttribName, const char* AttribValue, Hlong TeamSize)
void HBarrier::CreateBarrier(const wchar_t* AttribName, const wchar_t* AttribValue, Hlong TeamSize)
(
Windows only)
static void HOperatorSet.CreateBarrier(HTuple attribName, HTuple attribValue, HTuple teamSize, out HTuple barrierHandle)
public HBarrier(HTuple attribName, HTuple attribValue, int teamSize)
public HBarrier(string attribName, string attribValue, int teamSize)
void HBarrier.CreateBarrier(HTuple attribName, HTuple attribValue, int teamSize)
void HBarrier.CreateBarrier(string attribName, string attribValue, int teamSize)
Description
A barrier is a synchronization object blocking a thread until a previous
defined number of threads have reached this barrier.
create_barriercreate_barrierCreateBarrierCreateBarrierCreateBarriercreate_barrier
allocates and initializes the barrier object returned
in BarrierHandleBarrierHandleBarrierHandleBarrierHandlebarrierHandlebarrier_handle
according to the attributes specified in
AttribNameAttribNameAttribNameAttribNameattribNameattrib_name
and AttribValueAttribValueAttribValueAttribValueattribValueattrib_value
.
AttribNameAttribNameAttribNameAttribNameattribNameattrib_name
specifies the attribute class and AttribValueAttribValueAttribValueAttribValueattribValueattrib_value
the kind of the barrier. The description beneath lists all barrier kinds
supported by following parameter classes:
- ''""""""""""
empty string sets the default attributes.
- 'type'"type""type""type""type""type"
-
specifies what happens if a thread waits at a barrier:
- 'sleep'"sleep""sleep""sleep""sleep""sleep"
simply suspends the calling thread (default).
- 'spin'"spin""spin""spin""spin""spin"
a fast barrier implementation for short waits
that waits busy.
The TeamSizeTeamSizeTeamSizeTeamSizeteamSizeteam_size
argument specifies the number of threads that must
call wait_barrierwait_barrierWaitBarrierWaitBarrierWaitBarrierwait_barrier
before any of them successfully return from
waiting. The value hold in TeamSizeTeamSizeTeamSizeTeamSizeteamSizeteam_size
must be greater than zero.
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
AttribNameAttribNameAttribNameAttribNameattribNameattrib_name
(input_control) attribute.name(-array) →
HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)
Barrier attribute.
Default:
[]
List of values:
'type'"type""type""type""type""type"
AttribValueAttribValueAttribValueAttribValueattribValueattrib_value
(input_control) attribute.value(-array) →
HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)
Barrier attribute value.
Number of elements:
AttribValue == AttribName
Default:
[]
List of values:
'sleep'"sleep""sleep""sleep""sleep""sleep", 'spin'"spin""spin""spin""spin""spin"
TeamSizeTeamSizeTeamSizeTeamSizeteamSizeteam_size
(input_control) number →
HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Barrier team size.
Default:
1
BarrierHandleBarrierHandleBarrierHandleBarrierHandlebarrierHandlebarrier_handle
(output_control) barrier →
HBarrier, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Barrier synchronization object.
Result
create_barriercreate_barrierCreateBarrierCreateBarrierCreateBarriercreate_barrier
returns 2 (
H_MSG_TRUE)
if all parameters are correct.
If necessary, an exception is raised.
Possible Successors
wait_barrierwait_barrierWaitBarrierWaitBarrierWaitBarrierwait_barrier
,
clear_barrierclear_barrierClearBarrierClearBarrierClearBarrierclear_barrier
Module
Foundation