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

📄 readme_countingsemdemo.txt

📁 vxworks 下多线程编程事例代码 包括:管道
💻 TXT
字号:
FLE LIST - 	      countingSemDemo.c  DESCRIPTION - 	      Counting semaphore example.  Using binary semaphores for task 	      synchronization may, if the events can occur rapidly enough, cause 	      a loss of data, i.e. an event can be missed if the events can  	      occur faster then a task can process them. 	      Using counting semaphores may solve this problem. This  	      program demonstrates task synchronization using counting  	      semaphores. The user can also select to use a binary semaphore  	      instead of a counting semaphore in this demonstration, for 	      comparision between the two semaphores.  	      To run this code invoke the function countingSemDemo()  RUNNING DEMO - 	      Place the countingSemDemo.c file in your <Tornado> dir. Depending  	      on the target you have, define the CPU in your compile line and 	      use the Makefile in the BSP dir. to compile.  	      Run countingSemDemo() on vxworks target.  TESTED ON -   Host/Target : Solaris 2.5.1 / mv1604 	      VxWorks     : 5.3.1  	      EXAMPLE COMPILE LINE -  			    make CPU=PPC604 countingSemDemo.o  % make countingSemDemo.o ccppc -B/petaluma1/mayur/tor101-ppc/host/sun4-solaris2/lib/gcc-lib/  -mstrict-align -ansi -nostdinc -O2 -fvolatile -fno-builtin -fno-for-scope  -Wall -I/h   -I. -I/petaluma1/mayur/tor101-ppc/target/config/all  -I/petaluma1/mayur/tor101-ppc/target/h  -I/petaluma1/mayur/tor101-ppc/target/src/config  -I/petaluma1/mayur/tor101-ppc/target/src/drv -DCPU=PPC604  -DMV1600  -DTARGET_DIR="\"mv1604\""   -c countingSemDemo.c  OUTPUTS/LOGFILE -  On VxWorks target: ==================  -> sp countingSemDemo, 'c' task spawned: id = 5b7b40, name = u0 value = 5995328 = 0x5b7b40  The Output on Console: ====================== Semaphore Id        : 0x7fd238     Semaphore Type      : COUNTING   Task Queuing        : PRIORITY   Pended Tasks        : 0          Count               : 2           semaphore taken 1 times  Semaphore Id        : 0x7fd238     Semaphore Type      : COUNTING   Task Queuing        : PRIORITY   Pended Tasks        : 0          Count               : 1           semaphore taken 2 times  Semaphore Id        : 0x7fd238     Semaphore Type      : COUNTING   Task Queuing        : PRIORITY   Pended Tasks        : 0          Count               : 0           semaphore taken 3 times  On VxWorks target: ==================  -> sp countingSemDemo, 'b' task spawned: id = 5b7b40, name = u1 value = 5995328 = 0x5b7b40  The Output on Console: ====================== Semaphore Id        : 0x7fd238     Semaphore Type      : BINARY     Task Queuing        : PRIORITY   Pended Tasks        : 0          State               : FULL        semaphore taken 1 times  Semaphore Id        : 0x7fd238     Semaphore Type      : BINARY     Task Queuing        : PRIORITY   Pended Tasks        : 0          State               : EMPTY       semaphore taken 2 times     

⌨️ 快捷键说明

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