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

📄 semsmlib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 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.htm"><i>VxWorks API Reference :  OS 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><a href="./semSmLib.html#semBSmCreate">semBSmCreate</a>(&nbsp;)</b>  -  create and initialize a shared memory binary semaphore (VxMP Option)<br><b><a href="./semSmLib.html#semCSmCreate">semCSmCreate</a>(&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><a href="./semSmLib.html#semBSmCreate">semBSmCreate</a>(&nbsp;)</b>.  Shared memory counting semaphores are created using<b><a href="./semSmLib.html#semCSmCreate">semCSmCreate</a>(&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 entry<b><a href="./semBLib.html#top">semBLib</a></b>.<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 <b><a href="./semCLib.html#top">semCLib</a></b>.<p>For information about the generic semaphore-handling routines, see themanual entry for <b><a href="./semLib.html#top">semLib</a></b>.<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, set in the configurationparameter <b>SM_OBJ_MAX_SEM</b> .<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><dl><dt><b>Interrupt Use:</b><dd>Shared semaphores may not be given, taken, or flushed at interrupt level.<p><dt><b>Deletion:</b><dd>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 <b>S_smObjLib_NO_OBJECT_DESTROY</b> .<p><dt><b>Queuing Style:</b><dd>The shared semaphore queuing style specified when the semaphore is created must be FIFO.</dl></blockquote><h4>INTERRUPT LATENCY</h4><blockquote><p>Internally, interrupts are locked while manipulating shared semaphore data structures, thus increasing local CPU 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>usrSmObjInit(&nbsp;)</b>.  This is doneautomatically during VxWorks initialization when the component <b>INCLUDE_SM_OBJ</b>is included.<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="./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>usrSmObjInit(&nbsp;)</b>,<i>VxWorks Programmer's Guide: Shared Memory Objects, </i><i>VxWorks Programmer's Guide: Basic OS</i><hr><a name="semBSmCreate"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>semBSmCreate(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>semBSmCreate(&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><a href="./semLib.html#semGive">semGive</a>(&nbsp;)</b>, <b><a href="./semLib.html#semTake">semTake</a>(&nbsp;)</b>, and<b><a href="./semLib.html#semFlush">semFlush</a>(&nbsp;)</b> -- and the show routines, such as <b><a href="./usrLib.html#show">show</a>(&nbsp;)</b> and <b><a href="./semShow.html#semShow">semShow</a>(&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> , a configurable parameter.<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><b>S_memLib_NOT_ENOUGH_MEMORY</b>, <b>S_semLib_INVALID_QUEUE_TYPE</b>,<b>S_semLib_INVALID_STATE</b>, <b>S_smObjLib_LOCK_TIMEOUT</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="./smObjLib.html#top">smObjLib</a></b>, <b><a href="./semShow.html#top">semShow</a></b>,  <i>VxWorks Programmer's Guide: Basic OS</i><p><hr><a name="semCSmCreate"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>semCSmCreate(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>semCSmCreate(&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 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><a href="./semLib.html#semGive">semGive</a>(&nbsp;)</b>, <b><a href="./semLib.html#semTake">semTake</a>(&nbsp;)</b> and<b><a href="./semLib.html#semFlush">semFlush</a>(&nbsp;)</b> -- and the show routines, such as <b><a href="./usrLib.html#show">show</a>(&nbsp;)</b> and <b><a href="./semShow.html#semShow">semShow</a>(&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> , a configurable paramter.<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><b>S_memLib_NOT_ENOUGH_MEMORY</b>, <b>S_semLib_INVALID_QUEUE_TYPE</b>,<b>S_smObjLib_LOCK_TIMEOUT</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="./semCLib.html#top">semCLib</a></b>, <b><a href="./smObjLib.html#top">smObjLib</a></b>, <b><a href="./semShow.html#top">semShow</a></b>,  <i>VxWorks Programmer's Guide: Basic OS</i><p></body></html>

⌨️ 快捷键说明

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