亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pt-sem.h

?? IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR
?? H
字號:
/* * Copyright (c) 2004, Swedish Institute of Computer Science. * All rights reserved.  * * Redistribution and use in source and binary forms, with or without  * modification, are permitted provided that the following conditions  * are met:  * 1. Redistributions of source code must retain the above copyright  *    notice, this list of conditions and the following disclaimer.  * 2. Redistributions in binary form must reproduce the above copyright  *    notice, this list of conditions and the following disclaimer in the  *    documentation and/or other materials provided with the distribution.  * 3. Neither the name of the Institute nor the names of its contributors  *    may be used to endorse or promote products derived from this software  *    without specific prior written permission.  * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF  * SUCH DAMAGE.  * * This file is part of the protothreads library. *  * Author: Adam Dunkels <adam@sics.se> * * $Id: pt-sem.h,v 1.2 2005/02/24 10:36:59 adam Exp $ *//** * \addtogroup pt * @{ *//** * \defgroup ptsem Protothread semaphores * @{ * * This module implements counting semaphores on top of * protothreads. Semaphores are a synchronization primitive that * provide two operations: "wait" and "signal". The "wait" operation * checks the semaphore counter and blocks the thread if the counter * is zero. The "signal" operation increases the semaphore counter but * does not block. If another thread has blocked waiting for the * semaphore that is signalled, the blocked thread will become * runnable again. * * Semaphores can be used to implement other, more structured, * synchronization primitives such as monitors and message * queues/bounded buffers (see below). * * The following example shows how the producer-consumer problem, also * known as the bounded buffer problem, can be solved using * protothreads and semaphores. Notes on the program follow after the * example. * \code#include "pt-sem.h"#define NUM_ITEMS 32#define BUFSIZE 8static struct pt_sem mutex, full, empty;PT_THREAD(producer(struct pt *pt)){  static int produced;    PT_BEGIN(pt);    for(produced = 0; produced < NUM_ITEMS; ++produced) {      PT_SEM_WAIT(pt, &full);        PT_SEM_WAIT(pt, &mutex);    add_to_buffer(produce_item());        PT_SEM_SIGNAL(pt, &mutex);        PT_SEM_SIGNAL(pt, &empty);  }  PT_END(pt);}PT_THREAD(consumer(struct pt *pt)){  static int consumed;    PT_BEGIN(pt);  for(consumed = 0; consumed < NUM_ITEMS; ++consumed) {        PT_SEM_WAIT(pt, &empty);        PT_SEM_WAIT(pt, &mutex);        consume_item(get_from_buffer());        PT_SEM_SIGNAL(pt, &mutex);        PT_SEM_SIGNAL(pt, &full);  }  PT_END(pt);}PT_THREAD(driver_thread(struct pt *pt)){  static struct pt pt_producer, pt_consumer;  PT_BEGIN(pt);    PT_SEM_INIT(&empty, 0);  PT_SEM_INIT(&full, BUFSIZE);  PT_SEM_INIT(&mutex, 1);  PT_INIT(&pt_producer);  PT_INIT(&pt_consumer);  PT_WAIT_THREAD(pt, producer(&pt_producer) &		     consumer(&pt_consumer));  PT_END(pt);} \endcode * * The program uses three protothreads: one protothread that * implements the consumer, one thread that implements the producer, * and one protothread that drives the two other protothreads. The * program uses three semaphores: "full", "empty" and "mutex". The * "mutex" semaphore is used to provide mutual exclusion for the * buffer, the "empty" semaphore is used to block the consumer is the * buffer is empty, and the "full" semaphore is used to block the * producer is the buffer is full. * * The "driver_thread" holds two protothread state variables, * "pt_producer" and "pt_consumer". It is important to note that both * these variables are declared as <i>static</i>. If the static * keyword is not used, both variables are stored on the stack. Since * protothreads do not store the stack, these variables may be * overwritten during a protothread wait operation. Similarly, both * the "consumer" and "producer" protothreads declare their local * variables as static, to avoid them being stored on the stack. *  * */   /** * \file * Couting semaphores implemented on protothreads * \author * Adam Dunkels <adam@sics.se> * */#ifndef __PT_SEM_H__#define __PT_SEM_H__#include "pt.h"struct pt_sem {  unsigned int count;};/** * Initialize a semaphore * * This macro initializes a semaphore with a value for the * counter. Internally, the semaphores use an "unsigned int" to * represent the counter, and therefore the "count" argument should be * within range of an unsigned int. * * \param s (struct pt_sem *) A pointer to the pt_sem struct * representing the semaphore * * \param c (unsigned int) The initial count of the semaphore. * \hideinitializer */#define PT_SEM_INIT(s, c) (s)->count = c/** * Wait for a semaphore * * This macro carries out the "wait" operation on the semaphore. The * wait operation causes the protothread to block while the counter is * zero. When the counter reaches a value larger than zero, the * protothread will continue. * * \param pt (struct pt *) A pointer to the protothread (struct pt) in * which the operation is executed. * * \param s (struct pt_sem *) A pointer to the pt_sem struct * representing the semaphore * * \hideinitializer */#define PT_SEM_WAIT(pt, s)	\  do {						\    PT_WAIT_UNTIL(pt, (s)->count > 0);		\    --(s)->count;				\  } while(0)/** * Signal a semaphore * * This macro carries out the "signal" operation on the semaphore. The * signal operation increments the counter inside the semaphore, which * eventually will cause waiting protothreads to continue executing. * * \param pt (struct pt *) A pointer to the protothread (struct pt) in * which the operation is executed. * * \param s (struct pt_sem *) A pointer to the pt_sem struct * representing the semaphore * * \hideinitializer */#define PT_SEM_SIGNAL(pt, s) ++(s)->count#endif /* __PT_SEM_H__ *//** @} *//** @} */   

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产大陆a不卡| 日本不卡一区二区| 麻豆久久久久久久| 久久久噜噜噜久久中文字幕色伊伊| 亚洲福利一二三区| 欧美熟乱第一页| 日韩精品视频网| 欧美成人一级视频| 国产xxx精品视频大全| 国产精品精品国产色婷婷| 精品污污网站免费看| 国内精品伊人久久久久av一坑 | 亚洲视频 欧洲视频| 中文字幕乱码久久午夜不卡 | 国产欧美视频一区二区| 偷窥少妇高潮呻吟av久久免费| 欧美第一区第二区| 欧美日韩一区二区三区免费看| 国产亚洲精品aa| 久久精品免费看| 丝袜美腿高跟呻吟高潮一区| 国产精品成人在线观看| 日韩女优制服丝袜电影| 成a人片国产精品| 精品亚洲成a人| 另类小说一区二区三区| 香蕉影视欧美成人| 亚洲精品水蜜桃| 精品国产乱码久久久久久闺蜜| 成人动漫一区二区| av亚洲精华国产精华精华| 成人影视亚洲图片在线| 欧美日韩色综合| 色香蕉成人二区免费| 91传媒视频在线播放| 91丨九色porny丨蝌蚪| 欧美日本一区二区在线观看| 777欧美精品| 国产视频一区二区三区在线观看 | 一本大道久久a久久精二百 | 亚洲国产精品国自产拍av| 国产亚洲女人久久久久毛片| 91麻豆精品国产91| 亚洲免费资源在线播放| 久久机这里只有精品| 欧美网站大全在线观看| 2024国产精品视频| 日本午夜一区二区| 欧美日韩亚洲不卡| 亚洲欧美韩国综合色| 日本成人在线电影网| 国产精品美女一区二区在线观看| 亚洲18色成人| 极品少妇一区二区| 欧美不卡激情三级在线观看| 日本伦理一区二区| 91精彩视频在线观看| 久久女同性恋中文字幕| 久久精品国产久精国产爱| 亚洲国产综合视频在线观看| 白白色 亚洲乱淫| 自拍偷拍欧美激情| 国产精品污www在线观看| 国产精品短视频| 欧美va亚洲va在线观看蝴蝶网| 亚洲欧洲国产日韩| 99精品国产一区二区三区不卡| 3atv在线一区二区三区| 精品日韩成人av| 久久久综合精品| 激情深爱一区二区| 在线电影国产精品| 日本亚洲天堂网| 欧美成人午夜电影| 日韩黄色免费网站| 日韩丝袜情趣美女图片| 一区二区三区四区激情| 在线视频国内一区二区| 一区二区三区小说| 制服.丝袜.亚洲.中文.综合| 久久成人免费网| 国产视频一区二区在线| 国产成人免费视| 一区二区三区**美女毛片| 不卡欧美aaaaa| 亚洲另类在线一区| 91视频www| 亚洲午夜影视影院在线观看| 欧美欧美欧美欧美首页| 秋霞电影一区二区| 欧美国产日韩a欧美在线观看| 国产一区二区美女| 亚洲人精品午夜| 91精品国产91久久综合桃花| 国产馆精品极品| 91精品国产色综合久久ai换脸 | 午夜亚洲福利老司机| 欧美xxxxxxxxx| 91久久精品国产91性色tv| 狠狠色2019综合网| 国产精品久久久久永久免费观看| 欧美一区二区三区公司| 欧美优质美女网站| 在线一区二区三区四区五区| 99久久久久久99| 94-欧美-setu| 91国偷自产一区二区三区观看| 国产一区二区三区日韩| 国产精品88av| 欧美天天综合网| 日韩在线一区二区三区| 日本韩国一区二区| 久久综合九色欧美综合狠狠| 国产精品久久久久天堂| 国产三级一区二区| 裸体在线国模精品偷拍| 九九在线精品视频| 91精品国产一区二区三区蜜臀 | 欧美亚洲动漫精品| 欧美日韩一级片网站| 亚洲欧美另类久久久精品2019| 国产一区不卡在线| 日韩欧美一区在线| 国产女主播视频一区二区| 国产激情91久久精品导航| 欧美高清一级片在线观看| 国产成人av电影在线观看| 久久影院午夜论| 成人自拍视频在线| 亚洲精品ww久久久久久p站| 欧美一区二区三区视频在线观看| 日本中文字幕不卡| 自拍视频在线观看一区二区| 色屁屁一区二区| 东方aⅴ免费观看久久av| 亚洲精品日韩专区silk| 91精品婷婷国产综合久久性色| 日韩电影一二三区| 国产精品欧美久久久久无广告 | 亚洲电影在线播放| 精品国产一区二区三区久久久蜜月| 国内精品久久久久影院一蜜桃| 一区二区三区欧美激情| 国产精品久久久久aaaa| 欧美一区二区三区日韩| 成人听书哪个软件好| 久久久综合网站| 99综合影院在线| 极品瑜伽女神91| 亚洲午夜一二三区视频| 国产精品美女久久久久av爽李琼| 6080亚洲精品一区二区| 99久久国产免费看| 老司机午夜精品| 亚洲成a人v欧美综合天堂下载| 国产亚洲成aⅴ人片在线观看| 欧美成人video| 久久综合九色综合欧美亚洲| 欧美亚洲高清一区| 成人av在线一区二区三区| 青青草成人在线观看| 国产一区二区三区香蕉| 国产在线不卡一卡二卡三卡四卡| 九色porny丨国产精品| 天堂久久一区二区三区| 最新国产精品久久精品| 99久久er热在这里只有精品15| 色婷婷激情一区二区三区| 播五月开心婷婷综合| 国产99久久久久久免费看农村| 国产乱对白刺激视频不卡| 激情综合色丁香一区二区| 秋霞影院一区二区| 91蜜桃传媒精品久久久一区二区| 欧美亚洲禁片免费| 欧美日韩国产小视频| 精品国产网站在线观看| 亚洲精品一二三四区| 国产高清在线精品| 正在播放一区二区| 精品成人一区二区| 成人夜色视频网站在线观看| 欧美成人午夜电影| 日韩国产欧美视频| 成人天堂资源www在线| 中日韩免费视频中文字幕| 亚洲成人综合网站| 在线亚洲一区观看| 精品国产一区二区精华| 国产在线看一区| 91丨porny丨蝌蚪视频| 国产精品成人免费精品自在线观看| 国产精品久久久久久久久久久免费看 | av一区二区三区黑人| 国产亚洲制服色| 国产一区二区成人久久免费影院| 欧日韩精品视频| 国产精品福利av| 99天天综合性| 亚洲精品视频在线看|