create_eventT_create_eventCreateEventCreateEventcreate_event创建事件(算子)

名称

create_eventT_create_eventCreateEventCreateEventcreate_event — 创建事件同步对象。

签名

create_event( : : AttribName, AttribValue : EventHandle)

Herror T_create_event(const Htuple AttribName, const Htuple AttribValue, Htuple* EventHandle)

void CreateEvent(const HTuple& AttribName, const HTuple& AttribValue, HTuple* EventHandle)

void HEvent::HEvent(const HTuple& AttribName, const HTuple& AttribValue)

void HEvent::HEvent(const HString& AttribName, const HString& AttribValue)

void HEvent::HEvent(const char* AttribName, const char* AttribValue)

void HEvent::HEvent(const wchar_t* AttribName, const wchar_t* AttribValue)   ( Windows only)

void HEvent::CreateEvent(const HTuple& AttribName, const HTuple& AttribValue)

void HEvent::CreateEvent(const HString& AttribName, const HString& AttribValue)

void HEvent::CreateEvent(const char* AttribName, const char* AttribValue)

void HEvent::CreateEvent(const wchar_t* AttribName, const wchar_t* AttribValue)   ( Windows only)

static void HOperatorSet.CreateEvent(HTuple attribName, HTuple attribValue, out HTuple eventHandle)

public HEvent(HTuple attribName, HTuple attribValue)

public HEvent(string attribName, string attribValue)

void HEvent.CreateEvent(HTuple attribName, HTuple attribValue)

void HEvent.CreateEvent(string attribName, string attribValue)

def create_event(attrib_name: MaybeSequence[Union[int, float, str]], attrib_value: MaybeSequence[Union[int, float, str]]) -> HHandle

描述

事件是一种预锁定的互斥机制,它不属于特定线程,即可以由锁定线程之外的其他线程触发。这种理解类似于 WIN32-API 中事件的定义,或 POSIX 线程中计数为 0 的信号量。

create_eventcreate_eventCreateEventCreateEventCreateEventcreate_event 根据 AttribNameAttribNameAttribNameAttribNameattribNameattrib_nameAttribValueAttribValueAttribValueAttribValueattribValueattrib_value 指定的属性分配并初始化事件对象。 AttribNameAttribNameAttribNameAttribNameattribNameattrib_name 指定属性类,AttribValueAttribValueAttribValueAttribValueattribValueattrib_value 指定事件类型。下文描述了各属性类支持的互斥类型:

''""""""""""

空字符串设置默认属性。

'type'"type""type""type""type""type"

指定线程在事件信号上等待时的行为:

'sleep'"sleep""sleep""sleep""sleep""sleep"

仅暂停调用线程(默认)。

'spin'"spin""spin""spin""spin""spin"

一种快速事件实现,通过忙等待信号。此类型不可递归。

执行信息

参数

AttribNameAttribNameAttribNameAttribNameattribNameattrib_name (输入控制)  attribute.name(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

互斥属性。

默认值: []

值列表: 'type'"type""type""type""type""type"

AttribValueAttribValueAttribValueAttribValueattribValueattrib_value (输入控制)  attribute.value(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

互斥属性值。

元素数量: AttribValue == AttribName

默认值: []

值列表: 'sleep'"sleep""sleep""sleep""sleep""sleep", 'spin'"spin""spin""spin""spin""spin"

EventHandleEventHandleEventHandleEventHandleeventHandleevent_handle (输出控制)  event HEvent, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

事件同步对象。

结果

create_eventcreate_eventCreateEventCreateEventCreateEventcreate_event 在所有参数正确时返回 2 (H_MSG_TRUE)。如有必要,则抛出异常。

可能的后继

wait_eventwait_eventWaitEventWaitEventWaitEventwait_event, signal_eventsignal_eventSignalEventSignalEventSignalEventsignal_event, clear_eventclear_eventClearEventClearEventClearEventclear_event

另见

clear_eventclear_eventClearEventClearEventClearEventclear_event

模块

基础