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

📄 cond.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/cond.h * @brief Basic condition variable support. * * THIS CODE HAS NOT BEEN TESTED *  * @author Lane Phillips * @date Created: 02/18/2005 */#ifndef COND_H_#define COND_H_#include "msched.h"#include "tlist.h"#include "mutex.h"/** @brief Condition variable data structure */typedef struct {   /** @brief Thead list queue waiting on this condition variable */   tlist_t q;} mos_cond_t;/** @brief Init a condition variable data structure. * * Must init before use. * @param cond Condition variable to init */void mos_cond_init(mos_cond_t *cond);/** @brief Signal exactly one thread waiting on a condition variable. * * The calling thread should lock the mutex that the waiting thread used to * call mos_cond_wait().  Unlike semaphores, signals are lost when no threads * waiting. *  * @param cond Condition variable to signal */void mos_cond_signal(mos_cond_t *cond);/** @brief Signal all threads waiting on a condition variable. * * The calling thread should lock the mutex that the waiting threads used to * call mos_cond_wait().  Unlike semaphores, signals are lost when no threads * waiting. *  * @param cond Condition variable to signal */void mos_cond_broadcast(mos_cond_t *cond);/** @brief Wait on a condition variable. *  * Atomically releases the mutex and waits on the condition variable.  On return * the mutex is locked again.  The caller should use the same mutex that the * threads that call mos_cond_broadcast() or mos_cond_signal() use for this * condition variable. *  * @param cond Condition variable to wait on * @param mt Mutex to unlock.  Locked on return. */void mos_cond_wait(mos_cond_t *cond, mos_mutex_t *mt);// Not implemented yet//int8_t mos_cond_timedwait(mos_cond_t *cond, mutex *mt,//	const struct timespec *abstime);#endif

⌨️ 快捷键说明

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