MC-Basic:SEMAPHORESTATE/zh-hans

From SoftMC-Wiki
< MC-Basic:SEMAPHORESTATE
Revision as of 03:09, 28 April 2017 by Chi (talk | contribs) (Created page with "{{Languages}} == 缩写 == semstate == 格式 == ?semstate(<''semaphore name''>) == 适用版本 == Since Version 3.7.x == 描述 == 语句会返回信号量的状态:1...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
语言: [[::MC-Basic:SEMAPHORESTATE|English]]  • [[::MC-Basic:SEMAPHORESTATE/zh-hans|中文(简体)‎]]

缩写

semstate

格式

?semstate(<semaphore name>)

适用版本

Since Version 3.7.x

描述

语句会返回信号量的状态:1,如果该信号量已经被获取(busy)或者0,如果该信号量已经被释放。

全集用户信号量,结构成分信号量,该信号量会被传递至by-reference (within a function \ sub block)。


类型

取值范围

0 , 1

单位

默认值

使用范围

任务区, 终端

限制

A semaphore passed by-reference (within a function \ sub block).

例子

-->common shared sem1 as semaphore

-->?SemState(sem1)

-->0

-->?SemTake(sem1)

-->1

-->?semstate(sem1)

-->1

-->?SemState(sem1)

-->1

-->SemGive(sem1)

-->?SemState(sem1)

-->0

参见