📄 mutex.h
字号:
/*****************************************************************************
*
* Module : mutex.h
* Description : Simple Mutual Exclusion module that allows
* critical sections of code to have access to
* shared memory.
* OS : SLOS 0.09
* Platform : e7t
* History :
*
* November 10th, 2001 Andrew N. Sloss
* - started
*
* Notes : none...
*
*****************************************************************************/
/*****************************************************************************
* MACROS
*****************************************************************************/
#define aWAIT while (semaphore==1) {} mutex_gatelock();
#define aSIGNAL mutex_gateunlock();
#define bWAIT while (semaphore==1||semaphore==2) {} \
mutex_gatelock();
#define bSIGNAL mutex_gateunlock();
/*****************************************************************************
* EXTERNAL
*****************************************************************************/
extern unsigned volatile int semaphore; /* do not direct access */
/* -- mutex_gatelock ----------------------------------------------------------
*
* Description : Locks the semaphore...
*
* Parameters : none...
* Return : none...
* Notes :
*
*/
void mutex_gatelock (void);
/* -- mutex_gateunlock --------------------------------------------------------
*
* Description : Unlocks the semaphore ...
*
* Parameters : none...
* Return : none...
* Notes :
*
*/
void mutex_gateunlock (void);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -