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

📄 semsmlib.html

📁 vxworks相关论文
💻 HTML
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/semSmLib.html - generated by refgen from semSmLib.c --> <title> semSmLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual :  Libraries</i></a></p></blockquote><h1>semSmLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>semSmLib</strong> - shared memory semaphore library (VxMP Option) </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./semSmLib.html#semBSmCreate">semBSmCreate</a></i>(&nbsp;)</b>  -  create and initialize a shared memory binary semaphore (VxMP Option)<br><b><i><a href="./semSmLib.html#semCSmCreate">semCSmCreate</a></i>(&nbsp;)</b>  -  create and initialize a shared memory counting semaphore (VxMP Option)<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides the interface to VxWorks shared memory binary andcounting semaphores.  Once a shared memory semaphore is created, thegeneric semaphore-handling routines provided in <b><a href="./semLib.html#top">semLib</a></b> are used tomanipulate it.  Shared memory binary semaphores are created using<b><i><a href="./semSmLib.html#semBSmCreate">semBSmCreate</a></i>(&nbsp;)</b>.  Shared memory counting semaphores are created using<b><i><a href="./semSmLib.html#semCSmCreate">semCSmCreate</a></i>(&nbsp;)</b>.<p>Shared memory binary semaphores are used to:  (1) control mutuallyexclusive access to multiprocessor-shared data structures, or (2)synchronize multiple tasks running in a multiprocessor system.  Forgeneral information about binary semaphores, see the manual entrysemBLib.<p>Shared memory counting semaphores are used for guarding multiple instancesof a resource used by multiple CPUs.  For general information about sharedcounting semaphores, see the manual entry for semCLib.<p>For information about the generic semaphore-handling routines, see themanual entry for semLib.<p></blockquote><h4>MEMORY REQUIREMENTS</h4><blockquote><p>The semaphore structure is allocated from a dedicated shared memory partition.<p>The shared semaphore dedicated shared memory partition is initialized bythe shared memory objects master CPU.  The size of this partition isdefined by the maximum number of shared semaphores, defined by<b>SM_OBJ_MAX_SEM</b> in the configuration header file.<p>This memory partition is common to shared binary and counting semaphores,thus <b>SM_OBJ_MAX_SEM</b> must be set to the sum total of binary and countingsemaphores to be used in the system.<p></blockquote><h4>RESTRICTIONS</h4><blockquote><p>Shared memory semaphores differ from local semaphores in the following ways:<p></blockQuote><h4>Interrupt Use. 1</h4><blockQuote>Shared semaphores may not be given, taken, or flushed at interrupt level.<p></blockQuote><h4>Deletion. 1</h4><blockQuote>There is no way to delete a shared semaphore and free its associatedshared memory.  Attempts to delete a shared semaphore return ERROR andset <b>errno</b> to S_smObjLib_NO_OBJECT_DESTROY.<p></blockQuote><h4>Queuing Style. 1</h4><blockQuote>The shared semaphore queuing style specified when the semaphore is created must be FIFO.<p></blockquote><h4>INTERRUPT LATENCY</h4><blockquote><p>Internally, interrupts are locked while manipulating shared semaphore data structures, thus increasing the interrupt latency.<p></blockquote><h4>CONFIGURATION</h4><blockquote><p>Before routines in this library can be called, the shared memory objectfacility must be initialized by calling <b><i><a href="./usrSmObj.html#usrSmObjInit">usrSmObjInit</a></i>(&nbsp;)</b>, which is found in<b>src/config/usrSmObj.c</b>.  This is done automatically from the roottask, <b><i><a href="./usrConfig.html#usrRoot">usrRoot</a></i>(&nbsp;)</b>, in <b>usrConfig.c</b> when the configuration macro <b>INCLUDE_SM_OBJ</b>is defined.<p></blockquote><h4>AVAILABILITY</h4><blockquote><p>This module is distributed as a component of the unbundled shared memorysupport option, VxMP.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>semSmLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./semSmLib.html#top">semSmLib</a></b>, <b><a href="./semLib.html#top">semLib</a></b>, <b><a href="./semBLib.html#top">semBLib</a></b>, <b><a href="./semCLib.html#top">semCLib</a></b>, <b><a href="./smObjLib.html#top">smObjLib</a></b>, <b><a href="./semShow.html#top">semShow</a></b>, <b><i><a href="./usrSmObj.html#usrSmObjInit">usrSmObjInit</a></i>(&nbsp;)</b>,  <i>VxWorks Programmer's Guide: Shared Memory Objects, Basic OS</i><hr><a name="semBSmCreate"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>semBSmCreate</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>semBSmCreate</i>(&nbsp;)</strong> - create and initialize a shared memory binary semaphore (VxMP Option)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>SEM_ID semBSmCreate    (    int         options,     /* semaphore options */    SEM_B_STATE initialState /* initial semaphore state */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine allocates and initializes a shared memory binary semaphore.The semaphore is initialized to an <i>initialState</i> of either<b>SEM_FULL</b> (available) or <b>SEM_EMPTY</b> (not available).  The shared semaphorestructure is allocated from the shared semaphore dedicated memorypartition.<p>The semaphore ID returned by this routine can be used directly by thegeneric semaphore-handling routines in <b><a href="./semLib.html#top">semLib</a></b> -- <b><i><a href="./semLib.html#semGive">semGive</a></i>(&nbsp;)</b>, <b><i><a href="./semLib.html#semTake">semTake</a></i>(&nbsp;)</b>, and<b><i><a href="./semLib.html#semFlush">semFlush</a></i>(&nbsp;)</b> -- and the show routines, such as <b><i><a href="./usrLib.html#show">show</a></i>(&nbsp;)</b> and <b><i><a href="./semShow.html#semShow">semShow</a></i>(&nbsp;)</b>.<p>The queuing style for blocked tasks is set by <i>options</i>; the onlysupported queuing style for shared memory semaphores is first-in-first-out,selected by <b>SEM_Q_FIFO</b>.<p>Before this routine can be called, the shared memory objects facility mustbe initialized (see <b><a href="./semSmLib.html#top">semSmLib</a></b>).<p>The maximum number of shared memory semaphores (binary plus counting) thatcan be created is <b>SM_OBJ_MAX_SEM</b>.<p></blockquote><h4>AVAILABILITY</h4><blockquote><p>This routine is distributed as a component of the unbundled shared memorysupport option, VxMP.<p></blockquote><h4>RETURNS</h4><blockquote><p>The semaphore ID, or NULL if memory cannot be allocated from the shared semaphore dedicated memory partition.<p></blockquote><h4>ERRNO</h4><blockquote><p>S_memLib_NOT_ENOUGH_MEMORY, S_semLib_INVALID_QUEUE_TYPE,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S_semLib_INVALID_STATE,&nbsp;S_smObjLib_LOCK_TIMEOUT<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./semSmLib.html#top">semSmLib</a></b>, <b><a href="./semLib.html#top">semLib</a></b>, <b><a href="./semBLib.html#top">semBLib</a></b>, <b><a href="./smObjLib.html#top">smObjLib</a></b>, <b><a href="./semShow.html#top">semShow</a></b><p><hr><a name="semCSmCreate"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>semCSmCreate</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>semCSmCreate</i>(&nbsp;)</strong> - create and initialize a shared memory counting semaphore (VxMP Option)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>SEM_ID semCSmCreate    (    int options,     /* semaphore options */    int initialCount /* initial semaphore count */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine allocates and initializes a shared memory countingsemaphore.  The initial count value of the semaphore (the number oftimes the semaphore should be taken before it can be given) is specifiedby <i>initialCount</i>.<p>The semaphore ID returned by this routine can be used directly by thegeneric semaphore-handling routines in <b><a href="./semLib.html#top">semLib</a></b> -- <b><i><a href="./semLib.html#semGive">semGive</a></i>(&nbsp;)</b>, <b><i><a href="./semLib.html#semTake">semTake</a></i>(&nbsp;)</b> and<b><i><a href="./semLib.html#semFlush">semFlush</a></i>(&nbsp;)</b> -- and the show routines, such as <b><i><a href="./usrLib.html#show">show</a></i>(&nbsp;)</b> and <b><i><a href="./semShow.html#semShow">semShow</a></i>(&nbsp;)</b>.<p>The queuing style for blocked tasks is set by <i>options</i>; the onlysupported queuing style for shared memory semaphores is first-in-first-out,selected by <b>SEM_Q_FIFO</b>.<p>Before this routine can be called, the shared memory objects facility mustbe initialized (see <b><a href="./semSmLib.html#top">semSmLib</a></b>).<p>The maximum number of shared memory semaphores (binary plus counting) thatcan be created is <b>SM_OBJ_MAX_SEM</b>.<p></blockquote><h4>AVAILABILITY</h4><blockquote><p>This routine is distributed as a component of the unbundled shared memorysupport option, VxMP.<p></blockquote><h4>RETURNS</h4><blockquote><p>The semaphore ID, or NULL if memory cannot be allocatedfrom the shared semaphore dedicated memory partition.<p></blockquote><h4>ERRNO</h4><blockquote><p>S_memLib_NOT_ENOUGH_MEMORY, S_semLib_INVALID_QUEUE_TYPE,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S_smObjLib_LOCK_TIMEOUT<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./semSmLib.html#top">semSmLib</a></b>, <b><a href="./semLib.html#top">semLib</a></b>, <b><a href="./semCLib.html#top">semCLib</a></b>, <b><a href="./smObjLib.html#top">smObjLib</a></b>, <b><a href="./semShow.html#top">semShow</a></b><p></body></html>

⌨️ 快捷键说明

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