acl  3.5.3.0
fiber_event.h 文件参考
#include "fiber_define.h"
+ fiber_event.h 的引用(Include)关系图:
+ 此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

宏定义

#define FIBER_FLAG_USE_MUTEX   (1 << 0)
 
#define FIBER_FLAG_USE_FATAL   (1 << 1)
 

类型定义

typedef struct ACL_FIBER_EVENT ACL_FIBER_EVENT
 

函数

FIBER_API ACL_FIBER_EVENTacl_fiber_event_create (unsigned flag)
 
FIBER_API void acl_fiber_event_free (ACL_FIBER_EVENT *event)
 
FIBER_API int acl_fiber_event_wait (ACL_FIBER_EVENT *event)
 
FIBER_API int acl_fiber_event_trywait (ACL_FIBER_EVENT *event)
 
FIBER_API int acl_fiber_event_notify (ACL_FIBER_EVENT *event)
 

宏定义说明

◆ FIBER_FLAG_USE_FATAL

#define FIBER_FLAG_USE_FATAL   (1 << 1)

if this flag is set, msg_fatal will be used other msg_error when error happened, this flag is optional for users

在文件 fiber_event.h30 行定义.

◆ FIBER_FLAG_USE_MUTEX

#define FIBER_FLAG_USE_MUTEX   (1 << 0)

when the fiber_event is used in multiple threads for sync, if there're many threads, the flag FIBER_FLAG_USE_MUTEX should be set to avoid internal thundering herd which maybe happen by using atomic; if the threads' number is less than one hundred, the flag FIBER_FLAG_USE_MUTEX needn't be set

在文件 fiber_event.h24 行定义.

类型定义说明

◆ ACL_FIBER_EVENT

fiber event mutex object based on IO event, which is thread safety. That's to say one event object can used in different threads

在文件 fiber_event.h16 行定义.

函数说明

◆ acl_fiber_event_create()

FIBER_API ACL_FIBER_EVENT* acl_fiber_event_create ( unsigned  flag)

create fiber event mutex which can be used in fibers mode or threads mode

参数
flag{unsigned} define as FIBER_FLAG_XXX above
返回
{ACL_FIBER_EVENT *}

◆ acl_fiber_event_free()

FIBER_API void acl_fiber_event_free ( ACL_FIBER_EVENT event)

free event mutex returned by acl_fiber_event_create

参数
{ACL_FIBER_EVENT*}

◆ acl_fiber_event_notify()

FIBER_API int acl_fiber_event_notify ( ACL_FIBER_EVENT event)

the event's owner notify the waiters that the event mutex can be available, and the waiter will get the event mutex

参数
{ACL_FIBER_EVENT*}
返回
{int} 0 returned if successful, or -1 if error happened

◆ acl_fiber_event_trywait()

FIBER_API int acl_fiber_event_trywait ( ACL_FIBER_EVENT event)

try to wait for event can be available

参数
{ACL_FIBER_EVENT*}
返回
{int} 0 returned if successful, or -1 if the event been locked

◆ acl_fiber_event_wait()

FIBER_API int acl_fiber_event_wait ( ACL_FIBER_EVENT event)

wait for event can be available

参数
{ACL_FIBER_EVENT*}
返回
{int} 0 returned if successful, or -1 if error happened