acl
3.5.3.0
|
#include "fiber_define.h"
宏定义 | |
#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_EVENT * | acl_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) |
#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.h 第 30 行定义.
#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.h 第 24 行定义.
typedef struct ACL_FIBER_EVENT 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.h 第 16 行定义.
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 |
FIBER_API void acl_fiber_event_free | ( | ACL_FIBER_EVENT * | event | ) |
free event mutex returned by acl_fiber_event_create
{ACL_FIBER_EVENT | *} |
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 | *} |
FIBER_API int acl_fiber_event_trywait | ( | ACL_FIBER_EVENT * | event | ) |
try to wait for event can be available
{ACL_FIBER_EVENT | *} |
FIBER_API int acl_fiber_event_wait | ( | ACL_FIBER_EVENT * | event | ) |
wait for event can be available
{ACL_FIBER_EVENT | *} |