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

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

?? semclib.c

?? vxworks 5.5 kernel code
?? C
字號:
/* semCLib.c - counting semaphore library *//* Copyright 1984-2002 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------02e,03may02,pcm  removed possible NULL dereference in semCCreate () (SPR 76721)02d,09nov01,dee  add CPU_FAMILY != COLDFIRE in portable test02c,18oct01,bwa  Fixed problem when the semaphore could be deleted while                 sending events.02b,07sep01,bwa  Added VxWorks events support.02a,04sep98,cdp  make ARM CPUs with ARM_THUMB==TRUE use portable routines.02a,03mar00,zl   merged SH support into T201z,17feb98,cdp  undo 01y: put ARM back in list of optimised CPUs.01y,21oct97,kkk  undo 01x, take out ARM from list of optimized CPUs.01x,20may97,jpd  added ARM to list of optimised CPUs.01w,24jun96,sbs  made windview instrumentation conditionally compiled01v,22oct95,jdi  doc: added bit values for semCCreate() options (SPR 4276).01u,19mar95,dvs  removing tron references.01t,09jun93,hdn  added a support for I80X8601w,14apr94,smb  fixed class dereferencing for instrumentation macros01v,15mar94,smb  modified instrumentation macros01u,24jan94,smb  added instrumentation macros01t,10dec93,smb  added instrumentation01s,20jan93,jdi  documentation cleanup for 5.1.01r,13nov92,jcf  semCCreate call semCLibInit for robustness.01q,28jul92,jcf  semC{Create,Init} call semCLibInit for robustness.01p,09jul92,rrr  changed xsignal.h to private/sigLibP.h01o,04jul92,jcf  added semCLibInit() to fill in semLib tables.01n,26may92,rrr  the tree shuffle01m,27apr92,rrr  added signal restarting01l,15sep91,ajm  added MIPS to list of optimized CPU's01k,04oct91,rrr  passed through the ansification filter                  -changed functions to ansi style		  -changed includes to have absolute path from h/		  -fixed #else and #endif		  -changed VOID to void		  -changed copyright notice01j,26sep91,hdn  added conditional flag for TRON optimized code.01i,05apr91,jdi	 documentation -- removed header parens and x-ref numbers;		 doc review by jcf.01h,24mar91,jdi  documentation cleanup.01g,05oct90,dnw  made semCInit() be NOMANUAL.01f,29aug90,jcf  documentation.01e,03aug90,jcf  documentation.01d,17jul90,dnw  changed to new objAlloc() call.01c,05jul90,jcf  optimized version now available.01b,26jun90,jcf  merged into one semaphore class.01a,20oct89,jcf  written based on v1g of semLib.*//*DESCRIPTIONThis library provides the interface to VxWorks countingsemaphores.  Counting semaphores are useful for guarding multipleinstances of a resource.A counting semaphore may be viewed as a cell in memory whose contentskeep track of a count.  When a task takes a counting semaphore, usingsemTake(), subsequent action depends on the state of the count:.IP (1) 4If the count is non-zero, it is decremented and the calling taskcontinues executing..IP (2)If the count is zero, the task will be blocked, pending the availabilityof the semaphore.  If a timeout is specified and the timeout expires, thepended task will be removed from the queue of pended tasks and enter theready state with an ERROR status.  A pended task is ineligible for CPUallocation.  Any number of tasks may be pended simultaneously on the samecounting semaphore..LPWhen a task gives a semaphore, using semGive(), the next available task inthe pend queue is unblocked.  If no task is pending on this semaphore, thesemaphore count is incremented.  Note that if a semaphore is given, and atask is unblocked that is of higher priority than the task that calledsemGive(), the unblocked task will preempt the calling task.A semFlush() on a counting semaphore will atomically unblock all pendedtasks in the semaphore queue.  So all tasks will be made ready before anytask actually executes.  The count of the semaphore will remain unchanged.INTERRUPT USAGECounting semaphores may be given but not taken from interrupt level.CAVEATSThere is no mechanism to give back or reclaim semaphores automatically whentasks are suspended or deleted.  Such a mechanism, though desirable, is notcurrently feasible.  Without explicit knowledge of the state of the guardedresource or region, reckless automatic reclamation of a semaphore couldleave the resource in a partial state.  Thus, if a task ceases executionunexpectedly, as with a bus error, currently owned semaphores will not begiven back, effectively leaving a resource permanently unavailable.  Themutual-exclusion semaphores provided by semMLib offer protection fromunexpected task deletion.INTERNAL:	WINDVIEW INSTRUMENTATIONLevel 1:	semCCreate() causes EVENT_SEMCCREATELevel 2 (for portable only):	semGive() causes EVENT_OBJ_SEMGIVE	semTake() causes EVENT_OBJ_SEMTAKELevel 3:	N/AINCLUDE FILES: semLib.hSEE ALSO: semLib, semBLib, semMLib,.pG "Basic OS"*//* LINTLIBRARY */#include "vxWorks.h"#include "classLib.h"#include "errno.h"#include "taskLib.h"#include "intLib.h"#include "errnoLib.h"#include "eventLib.h"#include "private/eventLibP.h"#include "private/sigLibP.h"#include "private/objLibP.h"#include "private/semLibP.h"#include "private/windLibP.h"#include "private/eventP.h"/* optimized version available for 680X0, MIPS, i86, SH, *//* COLDFIRE and ARM (excluding Thumb) */#if (defined(PORTABLE) || \     ((CPU_FAMILY != MC680X0) && \      (CPU_FAMILY != MIPS) && \      (CPU_FAMILY != I80X86) && \      (CPU_FAMILY != SH) && \      (CPU_FAMILY != COLDFIRE) && \      (CPU_FAMILY != ARM)) || \     ((CPU_FAMILY == ARM) && ARM_THUMB))#define semCLib_PORTABLE#endif/* locals */LOCAL BOOL	semCLibInstalled;		/* protect from muliple inits *//********************************************************************************* semCLibInit - initialize the binary semaphore management package* * SEE ALSO: semLibInit(1).* NOMANUAL*/STATUS semCLibInit (void)    {    if (!semCLibInstalled)	{	semGiveTbl [SEM_TYPE_COUNTING]		= (FUNCPTR) semCGive;	semTakeTbl [SEM_TYPE_COUNTING]		= (FUNCPTR) semCTake;	semFlushTbl [SEM_TYPE_COUNTING]		= (FUNCPTR) semQFlush;	semGiveDeferTbl [SEM_TYPE_COUNTING]	= (FUNCPTR) semCGiveDefer;	semFlushDeferTbl [SEM_TYPE_COUNTING]	= (FUNCPTR) semQFlushDefer;	if (semLibInit () == OK)	    semCLibInstalled = TRUE;	}    return ((semCLibInstalled) ? OK : ERROR);    }/********************************************************************************* semCCreate - create and initialize a counting semaphore** This routine allocates and initializes a counting semaphore.  The* semaphore is initialized to the specified initial count.** The <options> parameter specifies the queuing style for blocked tasks.* Tasks may be queued on a priority basis or a first-in-first-out basis.* These options are SEM_Q_PRIORITY (0x1) and SEM_Q_FIFO (0x0), respectively.* That parameter also specifies if semGive() should return ERROR when* the semaphore fails to send events. This option is turned off by default;* it is activated by doing a bitwise-OR of SEM_EVENTSEND_ERR_NOTIFY (0x10) * with the queuing style of the semaphore.** RETURNS: The semaphore ID, or NULL if memory cannot be allocated.*/SEM_ID semCCreate    (    int         options,                /* semaphore option modes */    int         initialCount            /* initial count */    )    {    SEM_ID semId;    if ((!semCLibInstalled) && (semCLibInit () != OK))	/* initialize package */	return (NULL);    if ((semId = (SEM_ID) objAlloc (semClassId)) == NULL)	return (NULL);    /* initialize allocated semaphore */    if (semCInit (semId, options, initialCount) != OK)	{	objFree (semClassId, (char *) semId);	return (NULL);	}#ifdef WV_INSTRUMENTATION    /* windview - level 1 event logging */    EVT_OBJ_3 (OBJ, semId, semClassId,	       EVENT_SEMCCREATE, semId, options, initialCount);#endif    return (semId);    }/********************************************************************************* semCInit - initialize a declared counting semaphore** The initialization of a static counting semaphore, or a counting semaphore* embedded in some larger object need not deal with allocation.* This routine may be called to initialize such a semaphore.  The semaphore* is initialized to the specified initial count.** Counting semaphore options include the queuing style for blocked tasks.* Tasks may be queued on the basis of their priority or first-in-first-out.* These options are SEM_Q_PRIORITY and SEM_Q_FIFO respectively.** SEE ALSO: semCCreate** NOMANUAL*/STATUS semCInit    (    SEMAPHORE   *pSemaphore,            /* pointer to semaphore to init */    int         options,                /* semaphore options */    int         initialCount            /* initial count */    )    {    if ((!semCLibInstalled) && (semCLibInit () != OK))	/* initialize package */	return (ERROR);    if (semQInit (pSemaphore, options) != OK)		/* initialize queue */	return (ERROR);    return (semCCoreInit (pSemaphore, options, initialCount));    }/********************************************************************************* semCCoreInit - initialize a counting semaphore with queue already initialized** To initialize a semaphore with some special queuing algorithm, this routine* is used.  This routine will initialize a counting semaphore without* initializing the queue.** ERRNO: S_semLib_INVALID_OPTION** NOMANUAL*/STATUS semCCoreInit    (    SEMAPHORE   *pSemaphore,            /* pointer to semaphore to init */    int         options,                /* semaphore options */    int         initialCount            /* initial count */    )    {    if ((options & SEM_INVERSION_SAFE) || (options & SEM_DELETE_SAFE))	{	errno = S_semLib_INVALID_OPTION;	return (ERROR);	}    pSemaphore->semCount = initialCount;		/* initialize count */    pSemaphore->recurse  = 0;				/* no recursive takes */    pSemaphore->options  = options;			/* stow away options */    pSemaphore->semType	 = SEM_TYPE_COUNTING;		/* type is counting */    eventInit (&pSemaphore->events);			/* initialize events */    /* initialize the semaphore object core information */#ifdef WV_INSTRUMENTATION    /* windview - connect instrumented class for level 1 event logging */    if (wvObjIsEnabled) objCoreInit (&pSemaphore->objCore, semInstClassId);    else#endif    objCoreInit (&pSemaphore->objCore, semClassId);    return (OK);    }#ifdef semCLib_PORTABLE/********************************************************************************* semCGive - give a semaphore** Gives the semaphore.  If a higher priority task has already taken* the semaphore (so that it is now pended waiting for it), that task* will now become ready to run, and preempt the task that does the semGive().* If the semaphore is already full (it has been given but not taken) this* call is essentially a no-op.** NOMANUAL*/STATUS semCGive    (    SEM_ID semId        /* semaphore ID to give */    )    {    int level = intLock ();			/* LOCK INTERRUPTS */    if (OBJ_VERIFY (semId, semClassId) != OK)	{	intUnlock (level);			/* UNLOCK INTERRUPTS */	return (ERROR);	}    if (Q_FIRST (&semId->qHead) == NULL)	{	int    	oldErrno;	STATUS  evStatus;	STATUS 	retStatus;	semId->semCount ++;			/* give semaphore */	retStatus = OK;	if (semId->events.taskId != (int)NULL)	    {	    kernelState = TRUE;	    intUnlock (level);	    oldErrno = errno;	    evStatus = eventRsrcSend (semId->events.taskId,				      semId->events.registered);	    if(evStatus != OK)		{		if ((semId->options & SEM_EVENTSEND_ERR_NOTIFY) != 0x0)		    {		    retStatus = ERROR;		    oldErrno = S_eventLib_EVENTSEND_FAILED;		    }	        semId->events.taskId = (int)NULL;		}	    else if ((semId->events.options & EVENTS_SEND_ONCE) != 0x0)	        semId->events.taskId = (int)NULL;	    windExit ();	    errno = oldErrno;	    return (retStatus);	    }	else	    intUnlock (level);	}    else	{	kernelState = TRUE;			/* KERNEL ENTER */	intUnlock (level);			/* UNLOCK INTERRUPTS */#ifdef WV_INSTRUMENTATION	/* windview - level 2 event logging */	EVT_TASK_1 (EVENT_OBJ_SEMGIVE, semId);#endif	windPendQGet (&semId->qHead);		/* unblock a task */	windExit ();				/* KERNEL EXIT */	}    return (OK);    }/********************************************************************************* semCTake - take a semaphore** Takes the semaphore.  If the semaphore is empty, i.e., it has not been given* since the last semTake() or semInit(), this task will become pended until* the semaphore becomes available by some other task doing a semGive()* of it.  If the semaphore is already available, this call will empty* the semaphore, so that no other task can take it until this task gives* it back, and this task will continue running.** WARNING* This routine may not be used from interrupt level.** NOMANUAL*/STATUS semCTake    (    SEM_ID semId,       /* semaphore ID to take */    int timeout         /* timeout in ticks */    )    {    int level;    int status;    if (INT_RESTRICT () != OK)			/* restrict isr use */	return (ERROR);again:    level = intLock ();				/* LOCK INTERRUPTS */    if (OBJ_VERIFY (semId, semClassId) != OK)	{	intUnlock (level);			/* UNLOCK INTERRUPTS */	return (ERROR);	}    if (semId->semCount > 0)	{	semId->semCount --;			/* take semaphore */	intUnlock (level);			/* UNLOCK INTERRUPTS */	return (OK); }    kernelState = TRUE;				/* KERNEL ENTER */    intUnlock (level);				/* UNLOCK INTERRUPTS */#ifdef WV_INSTRUMENTATION    /* windview - level 2 event logging */    EVT_TASK_1 (EVENT_OBJ_SEMTAKE, semId);#endif    if (windPendQPut (&semId->qHead, timeout) != OK)	{	windExit ();				/* KERNEL EXIT */	return (ERROR);	}    if ((status = windExit ()) == RESTART)	/* KERNEL EXIT */	{	timeout = SIG_TIMEOUT_RECALC(timeout);	goto again;	}    return (status);    }#endif	/* semCLib_PORTABLE *//********************************************************************************* semCGiveDefer - give a semaphore as deferred work** Gives the semaphore.  If a higher priority task has already taken* the semaphore (so that it is now pended waiting for it), that task* will now become ready to run, and preempt the task that does the semGive().* If the semaphore is already full (it has been given but not taken) this* call is essentially a no-op.** NOMANUAL*/void semCGiveDefer    (    SEM_ID semId        /* semaphore ID to give */    )    {     if (Q_FIRST (&semId->qHead) == NULL)		/* anyone blocked? */	{	semId->semCount ++;				/* give semaphore */	/* sem is free, send events if registered */	if (semId->events.taskId != (int)NULL)	    {	    if (eventRsrcSend (semId->events.taskId,			       semId->events.registered) != OK)		{		semId->events.taskId = (int)NULL;		return;		}	    if ((semId->events.options & EVENTS_SEND_ONCE) == EVENTS_SEND_ONCE)		semId->events.taskId = (int)NULL;	    }	}     else	{#ifdef WV_INSTRUMENTATION        /* windview - level 2 event logging */	EVT_TASK_1 (EVENT_OBJ_SEMGIVE, semId);#endif	windPendQGet (&semId->qHead);			/* unblock a task */	}    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品福利视频网站| 日韩一级片在线观看| 欧美在线不卡一区| 欧美精品一区视频| 一区二区三区在线观看视频| 麻豆91免费观看| 欧美羞羞免费网站| 国产网红主播福利一区二区| 日韩成人午夜精品| 99精品1区2区| 国产亚洲一二三区| 国产乱人伦精品一区二区在线观看| 欧美性欧美巨大黑白大战| 国产精品日产欧美久久久久| 日精品一区二区| 欧美日韩美女一区二区| 洋洋av久久久久久久一区| 成人av综合一区| 国产欧美综合色| 国产成人亚洲综合色影视| 欧美成人乱码一区二区三区| 日本中文字幕不卡| 欧美三级电影网站| 国产精品三级av| 成人免费av网站| 国产精品毛片大码女人| 岛国精品在线播放| 国产精品久久久久一区二区三区共 | 成人爱爱电影网址| 久久精品视频网| 国产 日韩 欧美大片| 欧美极品aⅴ影院| 大陆成人av片| 亚洲日本在线观看| 日本韩国一区二区三区| 一区二区三区电影在线播| 欧美在线视频日韩| 午夜电影网一区| 欧美一级日韩一级| 国产一区二区免费视频| 国产欧美日韩麻豆91| 91色视频在线| 亚洲一区二区成人在线观看| 欧美色图一区二区三区| 亚洲午夜久久久久久久久电影院| 欧美日韩一本到| 久久av资源网| 国产精品久久免费看| 欧洲色大大久久| 日韩高清在线观看| 国产日韩一级二级三级| 99国产精品国产精品毛片| 一级日本不卡的影视| 欧美一区二区在线看| 夫妻av一区二区| 亚洲成人你懂的| 国产欧美精品一区二区色综合| 91香蕉视频在线| 青青草精品视频| 1区2区3区国产精品| 欧美精选一区二区| 国产福利91精品一区二区三区| 亚洲精品久久久蜜桃| 精品欧美久久久| 91在线云播放| 久久av老司机精品网站导航| 亚洲色图在线视频| 欧美α欧美αv大片| 91麻豆国产福利精品| 久久99九九99精品| 亚洲综合色视频| 久久久久久99久久久精品网站| 色94色欧美sute亚洲13| 精品一区二区在线播放| 亚洲自拍都市欧美小说| 国产日韩欧美精品在线| 欧美日韩免费电影| 91蜜桃在线观看| 国产自产高清不卡| 天堂va蜜桃一区二区三区| 亚洲欧洲日本在线| 久久免费国产精品| 91精品国产综合久久久蜜臀粉嫩| 成人短视频下载| 国产一本一道久久香蕉| 亚洲va在线va天堂| 亚洲免费观看在线观看| 久久久精品黄色| 日韩精品一区国产麻豆| 欧美三电影在线| 在线看国产一区二区| 成人高清av在线| 成熟亚洲日本毛茸茸凸凹| 精品亚洲aⅴ乱码一区二区三区| 亚洲国产日韩av| 亚洲日韩欧美一区二区在线| 国产精品水嫩水嫩| 国产欧美1区2区3区| 精品国内二区三区| 欧美mv日韩mv亚洲| 欧美va亚洲va国产综合| 日韩一级免费观看| 777久久久精品| 制服丝袜亚洲播放| 555www色欧美视频| 91精品国产一区二区三区| 欧美色图第一页| 欧美三级三级三级| 欧美群妇大交群的观看方式| 欧美亚洲日本一区| 在线观看网站黄不卡| 在线看国产一区二区| 欧美视频一区二区三区| 欧美日韩免费电影| 欧美一区二区三区在| 欧美一三区三区四区免费在线看 | 欧美在线不卡视频| 精品污污网站免费看| 欧洲在线/亚洲| 欧美美女一区二区三区| 欧美一级黄色大片| 久久综合久久综合久久| 久久精品亚洲国产奇米99| 国产精品欧美综合在线| 亚洲视频一二三| 午夜精品一区二区三区电影天堂| 亚洲国产成人91porn| 麻豆91小视频| 国产·精品毛片| 91亚洲国产成人精品一区二三| 91在线观看一区二区| 欧美亚洲愉拍一区二区| 欧美一区二区三区日韩视频| 精品少妇一区二区三区免费观看 | 99精品视频在线免费观看| 色菇凉天天综合网| 91精品国产综合久久久蜜臀粉嫩| 日韩欧美二区三区| 国产精品久久午夜夜伦鲁鲁| 亚洲午夜久久久| 狠狠久久亚洲欧美| 色婷婷综合激情| 欧美一个色资源| 国产精品看片你懂得| 偷拍自拍另类欧美| 国产精品1区2区3区在线观看| 91亚洲精华国产精华精华液| 日韩一级免费观看| 亚洲同性gay激情无套| 蜜臀国产一区二区三区在线播放| 国产999精品久久久久久绿帽| 欧美日韩精品是欧美日韩精品| 久久久国际精品| 天天综合日日夜夜精品| 大胆亚洲人体视频| 日韩视频免费观看高清完整版在线观看| 久久久不卡网国产精品二区 | 国产成人免费9x9x人网站视频| 欧美午夜一区二区三区| 中文字幕欧美三区| 麻豆精品视频在线观看视频| 91丨九色丨国产丨porny| 欧美videossexotv100| 亚洲成人免费视| 成人av在线网站| 精品粉嫩超白一线天av| 亚洲福利一二三区| eeuss影院一区二区三区 | 亚洲午夜精品网| 国产91精品露脸国语对白| 日韩你懂的在线播放| 亚洲一区二区视频| jlzzjlzz国产精品久久| 精品欧美一区二区在线观看| 亚洲成人第一页| 在线观看免费一区| 亚洲免费观看在线视频| 成人精品高清在线| 久久久激情视频| 国产在线精品一区二区不卡了| 日韩亚洲欧美一区| 日本亚洲欧美天堂免费| 欧美日韩精品系列| 亚洲国产视频一区| 欧美日韩一级黄| 亚洲电影你懂得| 欧美在线一区二区| 亚洲影视在线播放| 在线这里只有精品| 亚洲制服欧美中文字幕中文字幕| 99re66热这里只有精品3直播| 国产欧美一区在线| 国产99精品在线观看| 亚洲国产电影在线观看| 成人伦理片在线| 亚洲天堂网中文字| 色婷婷亚洲综合| 亚洲午夜在线视频| 91精品国产综合久久久蜜臀粉嫩| 日本中文一区二区三区|