import
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#ifndef INCLUDED_OS_MUTEX_H
|
||||
#define INCLUDED_OS_MUTEX_H
|
||||
|
||||
|
||||
#ifndef INCLUDED_OS_TYPES_H
|
||||
#include <os_types.h>
|
||||
#endif /*INCLUDED_OS_TYPES_H*/
|
||||
|
||||
#ifndef INCLUDED_OS_TASK_H
|
||||
#include <os_task.h>
|
||||
#endif /*INCLUDED_OS_TASK_H*/
|
||||
|
||||
#ifndef INCLUDED_OS_WAITOBJECT_H
|
||||
#include <os_waitobject.h>
|
||||
#endif /*INCLUDED_OS_WAITOBJECT_H*/
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
typedef struct os_mutex_t os_mutex_t;
|
||||
|
||||
struct os_mutex_t{
|
||||
os_task_t* owner; // 被哪个任务锁定
|
||||
os_waitobject_t wait_obj;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* 接口 */
|
||||
|
||||
void os_mutex_init(os_mutex_t* self);
|
||||
|
||||
void os_mutex_destroy(os_mutex_t* self);
|
||||
|
||||
os_err_t os_mutex_trylock(os_mutex_t* self);
|
||||
|
||||
os_err_t os_mutex_lock(os_mutex_t* self);
|
||||
|
||||
void os_mutex_unlock(os_mutex_t* self);
|
||||
|
||||
os_err_t os_mutex_timed_lock(os_mutex_t* self, os_tick_t ticks);
|
||||
|
||||
void os_mutex_unlock_one(os_mutex_t* self);
|
||||
|
||||
#endif /*INCLUDED_OS_MUTEX_H*/
|
||||
Reference in New Issue
Block a user