| 123456789101112131415161718192021222324252627282930313233 |
- /************************************************************************
- * AUTHOR: NiuJiuRu
- * FILENAME: swmutex.h
- * DESCRIPTION: 互斥量, 也称独占锁
- * NOTE: 主要用于多线程同步访问全局共享资源
- * HISTORY:
- * 1, [2010-09-06] created by NiuJiuRu
- ***********************************************************************/
- #ifndef __SWMUTEX_H__
- #define __SWMUTEX_H__
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- /* 创建互斥量 */
- void *sw_mutex_create();
- /* 销毁互斥量 */
- void sw_mutex_destroy(void *hMutex);
- /* 互斥量上锁(超时设置的时间单位为: 毫秒, 并且当timeout = -1时表示无限等待) */
- int sw_mutex_lock(void *hMutex, int timeout);
- /* 互斥量解锁 */
- void sw_mutex_unlock(void *hMutex);
- #ifdef __cplusplus
- }
- #endif
- #endif /* __SWMUTEX_H__ */
|