acl/lib_acl/include/thread/acl_sem.h

34 lines
775 B
C
Raw Normal View History

2014-11-19 00:25:21 +08:00
#ifndef ACL_SEM_INCLUDE_H
#define ACL_SEM_INCLUDE_H
#ifdef __cplusplus
extern "C" {
#endif
2017-06-02 14:47:24 +08:00
#include "../stdlib/acl_define.h"
2014-11-19 00:25:21 +08:00
#if defined(_WIN32) || defined(_WIN64)
2014-11-19 00:25:21 +08:00
typedef struct ACL_SEM ACL_SEM;
struct ACL_SEM {
HANDLE id;
unsigned int volatile count;
};
ACL_API ACL_SEM *acl_sem_create2(const char *pathname,
unsigned int initial_value);
ACL_API ACL_SEM *acl_sem_create(unsigned int initial_value);
ACL_API void acl_sem_destroy(ACL_SEM *sem);
ACL_API int acl_sem_wait_timeout(ACL_SEM *sem, unsigned int timeout);
ACL_API int acl_sem_try_wait(ACL_SEM *sem);
ACL_API int acl_sem_wait(ACL_SEM *sem);
ACL_API unsigned int acl_sem_value(ACL_SEM *sem);
ACL_API int acl_sem_post(ACL_SEM *sem);
#endif
#ifdef __cplusplus
}
#endif
#endif