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

📄 sem.h

📁 MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis的0.9.5版本的源码。
💻 H
字号:
//  This file is part of MANTIS OS, Operating System//  See http://mantis.cs.colorado.edu/////  Copyright (C) 2003,2004,2005 University of Colorado, Boulder////  This program is free software; you can redistribute it and/or//  modify it under the terms of the mos license (see file LICENSE)/** @file micro/include/sem.h * @brief Semphore routines for use on sensor nodes. * @author Brian Shucker * @date 02/05/2003 */#ifndef SEMAPHORE_H_#define SEMAPHORE_H_#include <inttypes.h>#include "tlist.h"/** @brief Succeeded in decrementing semaphore */#define SEM_SUCCESS 0/** @brief Failed in decrementing semaphore */#define SEM_FAIL 1/** @brief Semaphore data structure */typedef struct {   /** @brief Current semaphore count */   int8_t val;   /** @brief List of threads waiting on semaphore */   tlist_t q;} mos_sem_t;/** @brief Init the semaphores with beginning value. * @param s Semaphore to init * @param value Value to give the semaphore */void mos_sem_init(mos_sem_t *s, int value);/** @brief Post the semaphore. * @param s Semaphore to post */void mos_sem_post(mos_sem_t *s);/** @brief Wake up a specific thread. * @param s Semaphore to post  * @param thread Thread */void mos_sem_select_post(mos_sem_t *s, uint16_t thread);/** @brief Wait on a semaphore. * @param s Semaphore */void mos_sem_wait(mos_sem_t *s);/** @brief Test the semaphore and decrement if possible, otherwise return. * @param s Semaphore * @return SEM_SUCCESS, SEM_FAIL */uint8_t mos_sem_try_wait(mos_sem_t *s);#endif

⌨️ 快捷键说明

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