⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sem.h

📁 还是arm7操作源码
💻 H
字号:
/******************************************************************************
    Copyright (c) 2006 by RockOS.
    All rights reserved.

    This software is supported by the Rock Software Workroom only.

    Any bugs please contact the author with e-mail or QQ:
     E-mail : baobaoba520@yahoo.com.cn
         QQ : 59681888
*******************************************************************************
File name   : sema.h
Description : header file for semaphore management for RockOS.
            : 
            : 
Auther      : sunxinqiu
History     :
  2006-3-15   first release.
******************************************************************************/
#ifndef __SEMA_H__
#define __SEMA_H__

#ifdef __cplusplus
extern "C" {
#endif

enum
{
    OS_SEMA_FREE    = 0,
    OS_SEMA_MUTEX   = 1,
    OS_SEMA_SYNC    = 2
};

typedef struct
{
    U16  state;
    BOOL tobefree;
    char name[MAX_NAME_LEN+1];

    U32 semaphore;

    HTASK ownerTask;    /* only for binary semaphore. */
    HQUEUE pendTaskQ;
}SEMACB;

extern SEMACB g_semaCB[];

STATUS sem_init(void);
HSEMA semCreate(U16 type, U32 value, const char * name);
STATUS semDestroy(HSEMA hSema);
STATUS semTake(HSEMA hSema, U32 timeout);
STATUS semGive(HSEMA hSema);
U16 getSemType(HSEMA hsema);
void semCheck (void);

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -