create_eventT_create_eventCreateEventCreateEventcreate_event (算子)
名称
create_eventT_create_eventCreateEventCreateEventcreate_event — 创建事件同步对象。
签名
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)
def create_event(attrib_name: MaybeSequence[Union[int, float, str]], attrib_value: MaybeSequence[Union[int, float, str]]) -> HHandle
描述
An event is a prelocked mutual exclusion that does not belong to a
thread, i.e., it can be signaled by a thread different from the locking
thread. This understanding is, e.g., close to the definition of an event in
WIN32-API or a semaphore with count 0 in POSIX threads.
create_eventcreate_eventCreateEventCreateEventCreateEventcreate_event allocates and initializes the event object according
to the attributes specified in AttribNameAttribNameAttribNameAttribNameattribNameattrib_name and AttribValueAttribValueAttribValueAttribValueattribValueattrib_value.
AttribNameAttribNameAttribNameAttribNameattribNameattrib_name specifies the attribute class and AttribValueAttribValueAttribValueAttribValueattribValueattrib_value
the kind of the event. The description beneath lists all mutex kinds
supported by following classes:
- ''""""""""""
empty string sets the default attributes.
- 'type'"type""type""type""type""type"
-
specifies what happens if a thread waits on a signal to
an event:
- 'sleep'"sleep""sleep""sleep""sleep""sleep"
simply suspends the calling thread (default).
- 'spin'"spin""spin""spin""spin""spin"
a fast event implementation that waits busy
on a signal. This type is non recursive.
执行信息
- 多线程类型:独立(即使使用独占算子也能并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
AttribNameAttribNameAttribNameAttribNameattribNameattrib_name (输入控制) attribute.name(-array) → HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)
Mutex attribute.
默认值:
[]
值列表:
'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)
Mutex attribute value.
元素数量:
AttribValue == AttribName
默认值:
[]
值列表:
'sleep'"sleep""sleep""sleep""sleep""sleep", 'spin'"spin""spin""spin""spin""spin"
EventHandleEventHandleEventHandleEventHandleeventHandleevent_handle (输出控制) event → HEvent, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Event synchronization object.
结果
create_eventcreate_eventCreateEventCreateEventCreateEventcreate_event 在所有参数正确时返回 2 ( H_MSG_TRUE )。如有必要,则抛出异常。
可能的后继
wait_eventwait_eventWaitEventWaitEventWaitEventwait_event,
signal_eventsignal_eventSignalEventSignalEventSignalEventsignal_event,
clear_eventclear_eventClearEventClearEventClearEventclear_event
另见
clear_eventclear_eventClearEventClearEventClearEventclear_event
模块
基础