2022-11-17 15:16:53 +08:00
|
|
|
#ifndef FIBER_MUTEX_INCLUDE_H
|
|
|
|
#define FIBER_MUTEX_INCLUDE_H
|
2022-11-07 18:28:28 +08:00
|
|
|
|
|
|
|
#include "fiber_define.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct ACL_FIBER_MUTEX ACL_FIBER_MUTEX;
|
|
|
|
|
2022-11-18 16:47:10 +08:00
|
|
|
#define FIBER_MUTEX_F_LOCK_TRY (1 << 0)
|
|
|
|
#define FIBER_MUTEX_F_SWITCH_FIRST (1 << 1)
|
2022-11-13 10:15:51 +08:00
|
|
|
|
2022-11-13 16:31:02 +08:00
|
|
|
FIBER_API ACL_FIBER_MUTEX *acl_fiber_mutex_create(unsigned flag);
|
|
|
|
FIBER_API void acl_fiber_mutex_free(ACL_FIBER_MUTEX *mutex);
|
|
|
|
FIBER_API int acl_fiber_mutex_lock(ACL_FIBER_MUTEX *mutex);
|
2022-11-13 23:37:41 +08:00
|
|
|
FIBER_API int acl_fiber_mutex_trylock(ACL_FIBER_MUTEX *mutex);
|
2022-11-13 16:31:02 +08:00
|
|
|
FIBER_API int acl_fiber_mutex_unlock(ACL_FIBER_MUTEX *mutex);
|
2022-11-07 18:28:28 +08:00
|
|
|
|
2022-12-10 17:11:29 +08:00
|
|
|
FIBER_API void acl_fiber_mutex_profile(void);
|
|
|
|
FIBER_API int acl_fiber_mutex_deadcheck(void);
|
|
|
|
|
2022-11-07 18:28:28 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|