http://blog.csdn.net/mrwangwang/article/details/7954236

cyg_flag_init
Name: cyg_flag_init ( ) - initialize a flag for use
Synopsis:
void cyg_flag_init
(
cyg_flag_t *flag /* flag to initialize */
)
Description: This initializes a flag for use. Flags are synchronization mechanism that allows threads to wait on a condition or a set of conditions. Each condition is represented as a bit. Bits are user defined.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_flag_destroy

  cyg_flag_destroy
Name: cyg_flag_destroy ( ) - destroy (invalidate) a flag
Synopsis:
void cyg_flag_destroy
(
cyg_flag_t *flag /* flag to destroy (invalidate) */
)
Description: This destroys or invalidates a flag. Be certain that no threads are waiting on or otherwise using a flag when you call this function or you may deadlock the system.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_flag_init

  cyg_flag_setbits
Name: cyg_flag_setbits ( ) - set bits (conditions) in a flag
Synopsis:
void cyg_flag_setbits
(
cyg_flag_t *flag, /* flag to modify */
cyg_flag_value_t value /* bits to set */
)
Description: This sets bits (conditions) to true in a flag. Any bit in "value" that is set to true (1) will set the equivalent bit in the flag. This may wake threads waiting on this flag as a result.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_flag_maskbits, cyg_flag_wait, cyg_flag_timed_wait, cyg_flag_poll, cyg_flag_peek, cyg_flag_waiting

  cyg_flag_maskbits
Name: cyg_flag_maskbits ( ) - clear conditions (bits) in a flag
Synopsis:
void cyg_flag_maskbits
(
cyg_flag_t *flag, /* flag to modify */
cyg_flag_value_t value /* bits to clear */
)
Description: This clears bits (conditions) in a flag. Any bit that is set to false (0) in "value" will be subsequently cleared in the flag. If "value" is set to 0, all conditions will be cleared, if "value" is set to all ones, no conditions will be cleared. Since this just clears conditions, no thread will run as a result of a call to this function.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_flag_setbits, cyg_flag_wait, cyg_flag_timed_wait, cyg_flag_poll, cyg_flag_peek, cyg_flag_waiting

  cyg_flag_wait
Name: cyg_flag_wait ( ) - wait forever on a flag
Synopsis:
cyg_flag_value_t cyg_flag_wait
(
cyg_flag_t *flag, /* flag to wait on */
cyg_flag_value_t pattern, /* pattern to wait for */
cyg_flag_mode_t mode /* mode of waiting */
)
Description: This causes the calling thread to wait on a set of bits (conditions) to be set in a given flag. The "mode" indicates how the pattern will be interpreted:

CYG_FLAG_WAITMODE_AND - return match if all conditions in the pattern are set in the flag

CYG_FLAG_WAITMODE_OR - return match if any of the conditions in the pattern are set in the flag.

CYG_FLAG_WAITMODE_CLR - automatically clear the conditions that caused the calling thread to return a match, IF there was a match.

CYG_FLAG_WAITMODE_CLR can be combined with CYG_FLAG_WAITMODE_AND or CYG_FLAG_WAITMODE_OR to clear the bits that caused the condition to be met by oring the bitfields together.

If the conditions are met, the pattern that caused the pattern match is returned. A value of 0 will be returned if the thread was awakened for another reason other than a pattern match or a bad value was specified as the mode.

Include: #include <cyg/kernel/kapi.h>
Returns: the pattern that caused a match or 0 if an error.
See Also: cyg_flag_setbits, cyg_flag_maskbits, cyg_flag_timed_wait, cyg_flag_poll, cyg_flag_peek, cyg_flag_waiting

  cyg_flag_timed_wait
Name: cyg_flag_timed_wait ( ) - wait on a flag until timeout
Synopsis:
cyg_flag_value_t cyg_flag_timed_wait
(
cyg_flag_t *flag, /* flag to wait on */
cyg_flag_value_t pattern, /* pattern to wait for */
cyg_flag_mode_t mode /* mode of waiting */
cyg_tick_count_t abstime /* absolute timeout value */
)
Description: This causes the calling thread to wait on a set of bits (conditions) to be set in a given flag. If the system clock goes beyond "abstime" the wait will timeout and an error will be returned. The "mode" indicates how the pattern will be interpreted:

CYG_FLAG_WAITMODE_AND - return match if all conditions in the pattern are set in the flag

CYG_FLAG_WAITMODE_OR - return match if any of the conditions in the pattern are set in the flag.

CYG_FLAG_WAITMODE_CLR - automatically clear the conditions that caused the calling thread to return a match, IF there was a match.

CYG_FLAG_WAITMODE_CLR can be combined with CYG_FLAG_WAITMODE_AND or CYG_FLAG_WAITMODE_OR to clear the bits that caused the condition to be met by oring the bitfields together.

If the conditions are met, the pattern that caused the pattern match is returned. A value of 0 will be returned if the thread timed out, was awakened for another reason other than a pattern match or a bad value was specified as the mode.

Include: #include <cyg/kernel/kapi.h>
Returns: the pattern that caused a match or 0 if an error or timeout.
See Also: cyg_flag_setbits, cyg_flag_maskbits, cyg_flag_wait, cyg_flag_poll, cyg_flag_peek, cyg_flag_waiting

  cyg_flag_poll
Name: cyg_flag_poll ( ) - test for pattern match but do not block
Synopsis:
cyg_flag_value_t cyg_flag_poll
(
cyg_flag_t *flag, /* flag to wait on */
cyg_flag_value_t pattern, /* pattern to wait for */
cyg_flag_mode_t mode /* mode of waiting */
)
Description: This causes the calling thread to check if a set of bits (conditions) have been set in a given flag. The "mode" indicates how the pattern will be interpreted:

CYG_FLAG_WAITMODE_AND - return match if all conditions in the pattern are set in the flag

CYG_FLAG_WAITMODE_OR - return match if any of the conditions in the pattern are set in the flag.

CYG_FLAG_WAITMODE_CLR - automatically clear the conditions that caused the calling thread to return a match, IF there was a match.

CYG_FLAG_WAITMODE_CLR can be combined with CYG_FLAG_WAITMODE_AND or CYG_FLAG_WAITMODE_OR to clear the bits that caused the condition to be met by oring the bitfields together.

If the conditions are met, the pattern that caused the pattern match is returned. A value of 0 will be returned if the thread timed out, was awakened for another reason other than a pattern match or a bad value was specified as the mode.

Include: #include <cyg/kernel/kapi.h>
Returns: the pattern that caused a match or 0 if there was no match.
See Also: cyg_flag_setbits, cyg_flag_maskbits, cyg_flag_wait, cyg_flag_timed_wait, cyg_flag_peek, cyg_flag_waiting

  cyg_flag_peek
Name: cyg_flag_peek ( ) - returns bits (conditions) currently set in a flag
Synopsis:
cyg_flag_value_t cyg_flag_peek
(
cyg_flag_t *flag /* flag to peek at */
)
Description: This returns the current bits (conditions) that are set in a given flag.
Include: #include <cyg/kernel/kapi.h>
Returns: the bits (conditions) as a bitmask that have been set in the flag.
See Also: cyg_flag_setbits, cyg_flag_maskbits, cyg_flag_wait, cyg_flag_timed_wait, cyg_flag_poll, cyg_flag_waiting

cyg_flag_waiting

Name:

cyg_flag_waiting ( ) - check to see if threads wait on a given flag

Synopsis:

cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag /* flag to check */)

Description:

This reports whether any threads are currently being blocked waiting for bits (conditions) to be set in the given flag.

Include:

#include <cyg/kernel/kapi.h>

Returns:

"true" if threads are being blocked, "false" otherwise.

See Also:

cyg_flag_setbits, cyg_flag_maskbits, cyg_flag_wait, cyg_flag_timed_wait, cyg_flag_poll, cyg_flag_peek

cyg_flag 系列函数的更多相关文章

  1. PHP进程通信基础——shmop 、sem系列函数使用

    PHP进程通信基础--shmop .sem系列函数使用 进程通信的原理就是在系统中开辟出一个共享区域,不管是管道也好,还是共享内存,都是这个原理.如果心中有了这个概念,就会很方便去理解代码.由于官网上 ...

  2. PHP 使用 curl_* 系列函数和 curl_multi_* 系列函数进行多接口调用时的性能对比

    在页面中调用的服务较多时,使用并行方式,即使用 curl_multi_* 系列函数耗时要小于 curl_* 系列函数. 测试环境 操作系统:Windows x64 Server:Apache PHP: ...

  3. 第8章 用户模式下的线程同步(1)_Interlocked系列函数

    8.1 原子访问:Interlocked系列函数(Interlock英文为互锁的意思) (1)原子访问的原理 ①原子访问:指的是一线程在访问某个资源的同时,能够保证没有其他线程会在同一时刻访问该资源. ...

  4. PHP ob系列函数详解

    一. 相关函数简介:    1.Flush:刷新缓冲区的内容,输出.    函数格式:flush()    说明:这个函数经常使用,效率很高.    2.ob_start :打开输出缓冲区    函数 ...

  5. Linux中exec()执行文件系列函数的使用说明

    函数原型: 描述:    exec()系列函数使用新的进程映像替换当前进程映像.    工作方式没有什么差别, 只是参数传递的方式不同罢了. 说明:    1. 这6个函数可分为两大类: execl( ...

  6. php Output Control 函数 ob_系列函数详解

    <?php /* * 输出缓冲控制 * * flush — 刷新输出缓冲 ob_clean — 清空(擦掉)输出缓冲区 ob_end_clean — 清空(擦除)缓冲区并关闭输出缓冲 ob_en ...

  7. 从简单需求到OLAP的RANK系列函数

    同事问了一个非常简单的问题,怎么取出每个partition里面另外一个列的最小值? create table t1 (int c1, int c2);   假如按照c2分区,0-10,10-20,20 ...

  8. PHP 载入图像 imagecreatefrom_gif_jpeg_png 系列函数

    imagecreatefrom 系列函数用于从文件或 URL 载入一幅图像. 载入图像 imagecreatefrom 系列函数用于从文件或 URL 载入一幅图像,成功返回图像资源,失败则返回一个空字 ...

  9. PHP中ob系列函数整理

    ob,输出缓冲区,是output buffering的简称,而不是output cache.ob用对了,是能对速度有一定的帮助,但是盲目的加上ob函数,只会增加CPU额外的负担. 下面我说说ob的基本 ...

随机推荐

  1. sql查询某段时间内的数据

    查询半小时内数据的方法 1.select * from 表名 where datediff(minute,createtime,getdate())<30 2.select * from 表名 ...

  2. 之前做web性能优化的一些个人心得

    一个web项目后期的维护主要在于性能方面.数据吞吐量一旦增大各种bug都出来了.那些通过硬件<数据库分表,数据库主从分离,读写分离>等的一些手段此处就不多说了.本文主要在编码方面做一个性能 ...

  3. 编码神器之sublime(插件安装)

    一款优秀的编辑器是程序员的左膀右臂,相信每一个程序员手边都有自己熟悉的编辑器. 从一开始使用sublime的时候就开始喜欢上了这款编辑器,被他强大的功能深深的吸引了. sublime的强大来源于他的扩 ...

  4. java后台正则验证

    public static boolean checkPhone(String phone) { Pattern pattern = Pattern.compile("^[1][3-8]+\ ...

  5. 关于懒加载(lazy loading)

    懒加载---即为延迟加载,顾名思义在需要的时候才加载,这样做效率会比较低,但是占用内存低,iOS设备内存资源有限,如果程序启动使用一次性加载的方式可能会耗尽内存,这时可以使用懒加载,先判断是否有,没有 ...

  6. iOS崩溃日志分析

    Incident Identifier: 55864905-937C-4172-B435-2ACA13D3070ECrashReporter Key: b85cab13431711060a5fab55 ...

  7. Visualsvn Server的搭建

    最近做项目在用svn,对svn有个初步了解,今天利用一点时间在本地配置了一个svn的服务端.整个过程分为以下几步: ①下载Visualsvn Server并且进行安装. ②安装好以后,在Visuals ...

  8. NetBeans中文乱码解决办法

    一.Windows下NetBeans中文乱码解决办法 找到你的Netbeans安装目录下的etc文件夹,用记事本打开netbeans.conf,找到netbeans_default_options(不 ...

  9. Python prettytable的使用方法

    Python prettytable的使用方法 prettytable可以整齐地输出一个表格信息: +-----------+------+------------+----------------- ...

  10. Python用format格式化字符串

    format是是python2.6新增的一个格式化字符串的方法,相对于老版的%格式方法,它有很多优点. 1.不需要理会数据类型的问题,在%方法中%s只能替代字符串类型 2.单个参数可以多次输出,参数顺 ...