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

浏览源代码.

类型定义

typedef struct ACL_FIBER_MUTEX ACL_FIBER_MUTEX
 
typedef struct ACL_FIBER_RWLOCK ACL_FIBER_RWLOCK
 

函数

FIBER_API ACL_FIBER_MUTEXacl_fiber_mutex_create (void)
 
FIBER_API void acl_fiber_mutex_free (ACL_FIBER_MUTEX *l)
 
FIBER_API void acl_fiber_mutex_lock (ACL_FIBER_MUTEX *l)
 
FIBER_API int acl_fiber_mutex_trylock (ACL_FIBER_MUTEX *l)
 
FIBER_API void acl_fiber_mutex_unlock (ACL_FIBER_MUTEX *l)
 
FIBER_API ACL_FIBER_RWLOCKacl_fiber_rwlock_create (void)
 
FIBER_API void acl_fiber_rwlock_free (ACL_FIBER_RWLOCK *l)
 
FIBER_API void acl_fiber_rwlock_rlock (ACL_FIBER_RWLOCK *l)
 
FIBER_API int acl_fiber_rwlock_tryrlock (ACL_FIBER_RWLOCK *l)
 
FIBER_API void acl_fiber_rwlock_wlock (ACL_FIBER_RWLOCK *l)
 
FIBER_API int acl_fiber_rwlock_trywlock (ACL_FIBER_RWLOCK *l)
 
FIBER_API void acl_fiber_rwlock_runlock (ACL_FIBER_RWLOCK *l)
 
FIBER_API void acl_fiber_rwlock_wunlock (ACL_FIBER_RWLOCK *l)
 

类型定义说明

◆ ACL_FIBER_MUTEX

fiber mutex, thread unsafety, one fiber mutex can only be used in the same thread, otherwise the result is unpredictable

在文件 fiber_lock.h16 行定义.

◆ ACL_FIBER_RWLOCK

fiber read/write mutex, thread unsafety, can only be used in the sampe thread

在文件 fiber_lock.h21 行定义.

函数说明

◆ acl_fiber_mutex_create()

FIBER_API ACL_FIBER_MUTEX* acl_fiber_mutex_create ( void  )

create one fiber mutex, can only be used in the same thread

返回
{ACL_FIBER_MUTEX*} fiber mutex returned

◆ acl_fiber_mutex_free()

FIBER_API void acl_fiber_mutex_free ( ACL_FIBER_MUTEX l)

free fiber mutex created by acl_fiber_mutex_create

参数
l{ACL_FIBER_MUTEX*} created by acl_fiber_mutex_create

◆ acl_fiber_mutex_lock()

FIBER_API void acl_fiber_mutex_lock ( ACL_FIBER_MUTEX l)

lock the specified fiber mutex, return immediately when locked, or will wait until the mutex can be used

参数
l{ACL_FIBER_MUTEX*} created by acl_fiber_mutex_create

◆ acl_fiber_mutex_trylock()

FIBER_API int acl_fiber_mutex_trylock ( ACL_FIBER_MUTEX l)

try lock the specified fiber mutex, return immediately no matter the mutex can be locked.

参数
l{ACL_FIBER_MUTEX*} created by acl_fiber_mutex_create
返回
{int} 0 returned when locking successfully, -1 when locking failed

◆ acl_fiber_mutex_unlock()

FIBER_API void acl_fiber_mutex_unlock ( ACL_FIBER_MUTEX l)

the fiber mutex be unlock by its owner fiber, fatal will happen when others release the fiber mutex

参数
l{ACL_FIBER_MUTEX*} created by acl_fiber_mutex_create

◆ acl_fiber_rwlock_create()

FIBER_API ACL_FIBER_RWLOCK* acl_fiber_rwlock_create ( void  )

create one fiber rwlock, can only be operated in the sampe thread

返回
{ACL_FIBER_RWLOCK*}

◆ acl_fiber_rwlock_free()

FIBER_API void acl_fiber_rwlock_free ( ACL_FIBER_RWLOCK l)

free rw mutex created by acl_fiber_rwlock_create

参数
l{ACL_FIBER_RWLOCK*} created by acl_fiber_rwlock_create

◆ acl_fiber_rwlock_rlock()

FIBER_API void acl_fiber_rwlock_rlock ( ACL_FIBER_RWLOCK l)

lock the rwlock, if there is no any write locking on it, the function will return immediately; otherwise, the caller will wait for all write locking be released. Read lock on it will successful when returning

参数
l{ACL_FIBER_RWLOCK*} created by acl_fiber_rwlock_create

◆ acl_fiber_rwlock_runlock()

FIBER_API void acl_fiber_rwlock_runlock ( ACL_FIBER_RWLOCK l)

the rwlock's Read-Lock owner unlock the rwlock

参数
l{ACL_FIBER_RWLOCK*} crated by acl_fiber_rwlock_create

◆ acl_fiber_rwlock_tryrlock()

FIBER_API int acl_fiber_rwlock_tryrlock ( ACL_FIBER_RWLOCK l)

try to locking the Readonly lock, return immediately no matter locking is successful.

参数
l{ACL_FIBER_RWLOCK*} crated by acl_fiber_rwlock_create @retur {int} 1 returned when successfully locked, or 0 returned if locking operation is failed.

◆ acl_fiber_rwlock_trywlock()

FIBER_API int acl_fiber_rwlock_trywlock ( ACL_FIBER_RWLOCK l)

try to lock the rwlock in Write Lock mode. return immediately no matter locking is successful.

参数
l{ACL_FIBER_RWLOCK*} created by acl_fiber_rwlock_create
返回
{int} 1 returned when locking successfully, or 0 returned when locking failed

◆ acl_fiber_rwlock_wlock()

FIBER_API void acl_fiber_rwlock_wlock ( ACL_FIBER_RWLOCK l)

lock the rwlock in Write Lock mode, return until no any one locking it

参数
l{ACL_FIBER_RWLOCK*} created by acl_fiber_rwlock_create

◆ acl_fiber_rwlock_wunlock()

FIBER_API void acl_fiber_rwlock_wunlock ( ACL_FIBER_RWLOCK l)

the rwlock's Write-Lock owner unlock the rwlock

参数
l{ACL_FIBER_RWLOCK*} created by acl_fiber_rwlock_create