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

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

?? mutexpxlib.c

?? vxworks的完整的源代碼
?? C
字號:
/* mutexPxLib.c - kernel mutexs and condition variables library *//* Copyright 1993-1994 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01d,24jan94,smb  added instrumentation macros01c,12jan94,kdl  added includes of intLib.h, sysLib.h; general cleanup.01b,13dec93,dvs  made NOMANUAL01a,18feb93,rrr  written.*//*DESCRIPTIONThis library provides the interface to kernel mutexs and condition variables.Mutexs provide mutually exclusive access to resources.  Condition variables,when used with mutexes, provide synchronization between threads.The example below illustrates the use of a mutex.  The first step is toinitialize the mutex (see mutex_init() for more details)..CS.ne 4    mutex_t mutex;    mutex_init (&mutex, ...);.CEThen guard a critical section or resource by taking the mutex withmutex_lock(), and exit the section or release the resource by giving themutex with a mutex_unlock().  For example:.CS.ne 4    mutex_lock (&mutex);	... /@ critical region, only accessible by a single thread at a time @/    mutex_unlock (&mutex);.CEA condition variable works in conjunction with a mutex to providesynchronization between multiple threads. A thread will block at acall to cond_wait() and remain blocked until another thread signalsthe condition with a call to cond_signal().  A condition variable isconsidered a resource and must be protected with a mutex.See cond_wait() and cond_signal() for more details.The following example is for a one byte pipe.  The writer will sit on thepipe until it can write the data.  The reader will abort the read if asignal occurs..CS.ne 4    struct pipe        {        mutex_t p_mutex;        cond_t  p_writer;        cond_t  p_reader;        int     p_empty;        char    p_data;        };    pipe_init (struct pipe *pPipe)        {        mutex_init (&pPipe->p_mutex, MUTEX_THREAD);        cond_init (&pPipe->p_reader, &pPipe->p_mutex);        cond_init (&pPipe->p_writer, &pPipe->p_mutex);        pPipe->p_empty = TRUE;        }    pipe_write (struct pipe *pPipe, char data)        {        mutex_lock (&pPipe->p_mutex);        while (pPipe->p_empty != TRUE)	    cond_wait (&pPipe->p_writer, &pPipe->p_mutex, 0, "pipe write", 0);        pPipe->p_empty = FALSE;        pPipe->p_data = data;	cond_signal (&pPipe->p_reader, &pPipe->p_mutex);        mutex_unlock (&pPipe->p_mutex);        }    pipe_read (struct pipe *pPipe)        {        char data;        int error;        mutex_lock (&pPipe->p_mutex);        while (pPipe->p_empty == TRUE)	    {	    error = cond_wait (&pPipe->p_reader, &pPipe->p_mutex,				SIGCATCH, "pipe read", 0);            if (error != 0)                {		mutex_unlock (&pPipe->p_mutex);                errno = error;                return -1;                }	    }        pPipe->p_empty = TRUE;        data = pPipe->p_data;	cond_signal (&pPipe->p_writer, &pPipe->p_mutex);        mutex_unlock (&pPipe->p_mutex);	return data;        }.CENOMANUAL*/#include "vxWorks.h"#include "private/sigLibP.h"#include "private/mutexPxLibP.h"#include "private/windLibP.h"#include "private/eventP.h"#include "timers.h"#include "errno.h"#include "intLib.h"#include "sysLib.h"/* locals *//* globals *//********************************************************************************* mutex_init - initialize a kernel mutex** This routine initializes a kernel mutex.** NOMANUAL*/void mutex_init    (    mutex_t     *pMutex,    void	*dummy    )    {    pMutex->m_owner = 0;    qInit (&pMutex->m_queue, Q_PRI_LIST, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);    }/********************************************************************************* mutex_destroy - Destroy a kernel mutex** This routine destroys a kernel mutex.** NOMANUAL*/void mutex_destroy    (    mutex_t	*pMutex    )    {    kernelState = TRUE;			/* ENTER KERNEL */    if (Q_FIRST (&pMutex->m_queue) != NULL)	{        /* windview - level 2 event logging */        EVT_TASK_1 (EVENT_OBJ_SEMFLUSH, pMutex);	windPendQFlush (&pMutex->m_queue);	}    windExit();				/* EXIT KERNEL */    }/********************************************************************************* cond_init - initialize a kernel condition variable** This routine initializes a kernel condition variable.** NOMANUAL*/void cond_init    (    cond_t	*pCond,    void	*pDummy    )    {    pCond->c_mutex = NULL;    qInit (&pCond->c_queue, Q_PRI_LIST, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);    }/********************************************************************************* cond_destroy - Destroy a kernel condition variable** This routine destroys a kernel condition variable.** NOMANUAL*/void cond_destroy    (    cond_t	*pCond    )    {    kernelState = TRUE;			/* ENTER KERNEL */    if (Q_FIRST (&pCond->c_queue) != NULL)	{        /* windview - level 2 event logging */        EVT_TASK_1 (EVENT_OBJ_SEMFLUSH, pCond);	windPendQFlush (&pCond->c_queue);	}    windExit();				/* EXIT KERNEL */    }/********************************************************************************* mutex_lock - Take a kernel mutex** This routine takes a kernel mutex.** NOMANUAL*/void mutex_lock    (    mutex_t	*pMutex    )    {    int level;    level = intLock ();			/* LOCK INTERRUPTS */    if (pMutex->m_owner == NULL)	{	pMutex->m_owner = (int) taskIdCurrent;	intUnlock (level);		/* UNLOCK INTERRUPTS */	return;	}    kernelState = TRUE;			/* ENTER KERNEL */    intUnlock (level);			/* UNLOCK INTERRUPTS */    /* windview - level 2 event logging */    EVT_TASK_1 (EVENT_OBJ_SEMTAKE, pMutex);    windPendQPut (&pMutex->m_queue, WAIT_FOREVER);    windExit ();			/* EXIT KERNEL */    }/********************************************************************************* mutex_unlock - Release a kernel mutex** This routine releases a kernel mutex.** NOMANUAL*/void mutex_unlock    (    mutex_t	*pMutex    )    {    int level;    if (pMutex->m_owner != (int) taskIdCurrent)	return;    level = intLock ();			/* LOCK INTERRUPTS */    if ((pMutex->m_owner = (int) Q_FIRST (&pMutex->m_queue)) != NULL)	{	kernelState = TRUE;		/* ENTER KERNEL */	intUnlock (level);		/* UNLOCK INTERRRUPTS */        /* windview - level 2 event logging */        EVT_TASK_1 (EVENT_OBJ_SEMGIVE, pMutex);	windPendQGet (&pMutex->m_queue);	windExit ();			/* EXIT KERNEL */	}    else	intUnlock (level);		/* UNLOCK INTERRUPTS */    }/********************************************************************************* cond_signal - Signal a condition variable** This routine signals a condition variable.  That is it will resume a* single thread that was suspended on a cond_wait().** NOMANUAL*/void cond_signal    (    cond_t	*pCond    )    {    WIND_TCB *pTcb;    kernelState = TRUE;			/* ENTER KERNEL */    if (Q_FIRST (&pCond->c_queue) != NULL)	{	if (pCond->c_mutex->m_owner == NULL)	    {	    pCond->c_mutex->m_owner = (int) Q_FIRST(&pCond->c_queue);             /* windview - level 2 event logging */            EVT_TASK_1 (EVENT_OBJ_SEMGIVE, pCond);	    windPendQGet (&pCond->c_queue);	    }	else	    {	    pTcb = (WIND_TCB *) Q_GET (&pCond->c_queue);	    Q_PUT (&pCond->c_mutex->m_queue, pTcb, pTcb->priority);	    }	if (Q_FIRST (&pCond->c_queue) == NULL)	    pCond->c_mutex = NULL;	}    windExit();				/* EXIT KERNEL */    }/********************************************************************************* cond_timedwait - Wait on a condition variable** This routine suspends the calling thread on the condition variable* pointed to by pCond.  The thread will resume when another thread signals* the condition variable using the function cond_signal().  The mutex* pointed to by pMutex must be owned by the calling thread.  While the* thread is suspended, the mutex will be given back.  When the thread* resumes, the mutex will be taken back.** The argument pTimeout is optional.  If it is NULL, then cond_timedwait will* wait indefinitely.  If it is not NULL, then it points to a timespec* structure with the minimum time cond_timedwait should suspend the thread.* If the minimum time has been reached, then cond_timedwait() return EAGAIN.** RETURNS* Cond_wait() returns 0 if another thread resumed it using cond_signal().* Otherwise it returns EINTR if a signal occured during the wait or EAGAIN* if the time expired.  In all cases the mutex pMutex is given during the* time suspended are taken back when the function returns.** NOMANUAL*/int cond_timedwait    (    cond_t			*pCond,		/* Cond to wait on */    mutex_t			*pMutex,	/* Mutex to give */    const struct timespec	*pTimeout	/* max time to wait */    )    {    int tickRate;    int wait;    int retval;    if (pTimeout != 0)	{	tickRate = sysClkRateGet();	wait = pTimeout->tv_sec * tickRate +		pTimeout->tv_nsec / (1000000000 / tickRate);	}    else	wait = WAIT_FOREVER;    kernelState = TRUE;			/* ENTER KERNEL */    if (pCond->c_mutex != 0 && pCond->c_mutex != pMutex)	{	windExit();			/* EXIT KERNEL */	return (EINVAL);	}    pCond->c_mutex = pMutex;    /* windview - level 2 event logging */    EVT_TASK_1 (EVENT_OBJ_SEMTAKE, pCond);    windPendQPut (&pCond->c_queue, wait);    if ((pMutex->m_owner = (int) Q_FIRST (&pMutex->m_queue)) != NULL)	{        /* windview - level 2 event logging */        EVT_TASK_1 (EVENT_OBJ_SEMGIVE, pMutex);	windPendQGet (&pMutex->m_queue);	}    if ((retval = windExit ()) != 0)	/* EXIT KERNEL */	{	mutex_lock(pMutex);	return (retval == RESTART) ? EINTR : EAGAIN;	}    return (0);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美国产三级电影视频| 不卡的电影网站| 亚洲成国产人片在线观看| 综合电影一区二区三区| 亚洲精品视频在线观看网站| 中文字幕视频一区| 亚洲视频资源在线| 一区二区三区色| 一区二区三区欧美在线观看| 亚洲一级二级三级| 丝袜亚洲另类欧美| 黄色精品一二区| 成人黄色电影在线 | 麻豆精品一区二区av白丝在线| 亚洲一区二区欧美| 美女精品自拍一二三四| 国产精品18久久久久久久久| 99r精品视频| 91国偷自产一区二区三区观看| 欧美午夜精品久久久久久超碰| 欧美日韩国产精品成人| 久久一区二区视频| 亚洲天堂中文字幕| 日韩av在线免费观看不卡| 国产原创一区二区| 97精品国产97久久久久久久久久久久 | 欧美无砖专区一中文字| 91精品国产一区二区三区香蕉| 久久麻豆一区二区| 亚洲自拍欧美精品| 国产精品亚洲一区二区三区妖精| www.在线成人| 91麻豆精品国产91久久久资源速度 | 欧美大肚乱孕交hd孕妇| 国产精品国产三级国产普通话三级| 依依成人综合视频| 美美哒免费高清在线观看视频一区二区 | 国产欧美一区二区精品性色| 一区二区三区日韩精品| 国产福利视频一区二区三区| 欧美人与禽zozo性伦| 久久精品一区八戒影视| 亚洲高清在线精品| bt欧美亚洲午夜电影天堂| 91精品国产品国语在线不卡| 国产精品福利一区二区三区| 蜜桃一区二区三区在线观看| 色婷婷综合久色| 久久久精品国产99久久精品芒果| 亚洲国产视频直播| 99精品欧美一区| 久久久久国色av免费看影院| 香蕉久久夜色精品国产使用方法| 国产不卡高清在线观看视频| 麻豆免费精品视频| 亚洲成a人片在线不卡一二三区| 国产欧美一区二区精品忘忧草| 91丨porny丨最新| ww久久中文字幕| 亚洲欧美日韩小说| 亚洲精品五月天| 欧美日韩国产综合一区二区三区| 国产精品久久久久一区二区三区共 | 日本aⅴ精品一区二区三区| 99久久99久久精品国产片果冻| 欧美不卡视频一区| 裸体健美xxxx欧美裸体表演| 91福利国产精品| 成人欧美一区二区三区白人| 国产东北露脸精品视频| 日韩美女主播在线视频一区二区三区| 亚洲一区二区欧美日韩| 在线观看区一区二| 一区二区三区在线视频观看| 91丝袜美女网| 亚洲黄色免费网站| 色老汉一区二区三区| 最新国产精品久久精品| 99久久精品费精品国产一区二区| 国产无一区二区| 成人手机电影网| 国产精品久久久久久亚洲毛片 | 欧美精品成人一区二区三区四区| 亚洲一区二区3| 欧美日韩视频在线观看一区二区三区 | 欧美综合在线视频| 亚洲午夜精品在线| 欧美高清一级片在线| 蜜臀91精品一区二区三区| 亚洲精品一区二区三区在线观看| 韩国女主播成人在线| 欧美国产激情二区三区| 国产精品亚洲专一区二区三区 | 国产精品国产自产拍在线| 久久精品国产99国产精品| 91精品视频网| 美日韩一区二区| 国产精品色哟哟网站| 日韩电影在线一区二区| 欧美va日韩va| 粉嫩蜜臀av国产精品网站| 亚洲欧美日韩一区| 经典三级视频一区| 欧洲一区二区三区在线| 日韩欧美在线一区二区三区| 日韩欧美亚洲国产另类| 亚洲精品一卡二卡| 色婷婷激情一区二区三区| 午夜精品久久久久影视| 精品国产一区久久| 99精品偷自拍| 热久久国产精品| 亚洲免费看黄网站| 久久综合精品国产一区二区三区| 色哟哟在线观看一区二区三区| 蜜桃一区二区三区在线观看| 亚洲视频一区二区在线观看| 日韩网站在线看片你懂的| 97精品视频在线观看自产线路二| 日产国产高清一区二区三区| 亚洲欧美怡红院| 宅男噜噜噜66一区二区66| av不卡在线观看| 制服丝袜av成人在线看| 久久久精品免费网站| 欧美在线观看你懂的| 国产精品99久久不卡二区| 亚洲成人av福利| 日韩美女精品在线| 久久久国产精品不卡| 日韩午夜av电影| 欧美日本不卡视频| 色婷婷综合久色| 91在线视频观看| 国产91精品免费| 国产一区二区三区国产| 日本不卡视频一二三区| 亚洲国产日日夜夜| 一区二区在线观看视频在线观看| 国产日本欧美一区二区| 精品女同一区二区| 日韩一卡二卡三卡四卡| 欧美高清视频一二三区| 欧美情侣在线播放| 欧美日韩国产综合一区二区三区| 91久久香蕉国产日韩欧美9色| 欧美一区二区三区啪啪| 亚洲综合一区在线| 91在线播放网址| 日本一不卡视频| 亚洲在线免费播放| 亚洲日穴在线视频| 一本大道av伊人久久综合| 奇米影视一区二区三区| ㊣最新国产の精品bt伙计久久| 精品免费日韩av| 91精品在线观看入口| 欧美探花视频资源| www.亚洲在线| av电影天堂一区二区在线观看| 国模大尺度一区二区三区| 国产另类ts人妖一区二区| 国产69精品久久久久毛片| 99久久精品国产导航| 欧美亚男人的天堂| 91精品国产品国语在线不卡| 精品国产成人在线影院| 中文字幕在线不卡一区二区三区| 国产精品国产自产拍高清av王其| 亚洲美女视频在线| 日韩不卡手机在线v区| 亚洲色图制服诱惑| 亚洲一区二区三区小说| 国产精品无人区| 最新日韩在线视频| 午夜欧美在线一二页| 激情欧美一区二区| 国产91在线|亚洲| 色综合咪咪久久| 日韩丝袜情趣美女图片| 欧美国产精品专区| 亚洲精品国产a久久久久久| 日日骚欧美日韩| 精品一区二区日韩| 9l国产精品久久久久麻豆| 欧美猛男gaygay网站| 久久久久国产精品人| 一区二区三区在线看| 美国三级日本三级久久99| 99久久国产综合精品女不卡| 7777精品久久久大香线蕉| 中文字幕乱码一区二区免费| 亚洲福利电影网| 国产91丝袜在线18| 欧美一级一级性生活免费录像| 中文字幕不卡一区| 久久国产精品无码网站| 欧美在线播放高清精品| 国产日韩欧美制服另类| 日本成人在线一区|