/*----------------------------------------------------------------------------
* RL-ARM - RTX
*----------------------------------------------------------------------------
* Name: RTX_EX1.C
* Purpose: Your First RTX example program
*----------------------------------------------------------------------------
*
* Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*---------------------------------------------------------------------------*/ #include "cmsis_os.h" /* Forward reference */
void threadX (void const *argument); /* Thread IDs */
osThreadId main_id;
osThreadId threadX_id; /* Thread definitions */
osThreadDef(threadX, osPriorityNormal, , ); /*----------------------------------------------------------------------------
* Thread X
*---------------------------------------------------------------------------*/
void threadX (void const *argument) {
for (;;) {
/* Wait for completion of do-this */
osSignalWait(0x0004, osWaitForever); /* do-that */
/* Pause for 20 ms until signaling event to main thread */
osDelay();
/* Indicate to main thread completion of do-that */
osSignalSet(main_id, 0x0004);
}
} /*----------------------------------------------------------------------------
* Main Thread
*---------------------------------------------------------------------------*/
int main (void) { /* Get main thread ID */
main_id = osThreadGetId();
/* Create thread X */
threadX_id = osThreadCreate(osThread(threadX), NULL);
for (;;) { /* do-this */
/* Indicate to thread X completion of do-this */
osSignalSet(threadX_id, 0x0004);
/* Wait for completion of do-that */
osSignalWait(0x0004, osWaitForever);
/* Wait now for 50 ms */
osDelay();
}
} /*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/

CMSIS Example - Signal的更多相关文章

  1. CMSIS Example - Signal and Yield

    /*---------------------------------------------------------------------------- * RL-ARM - RTX *----- ...

  2. java 线程 Lock 锁使用Condition实现线程的等待(await)与通知(signal)

    一.Condition 类 在前面我们学习与synchronized锁配合的线程等待(Object.wait)与线程通知(Object.notify),那么对于JDK1.5 的 java.util.c ...

  3. Linux 信号(二)—— signal 函数

    弗洛伊德认为:要解决这些苦恼,当事人就要通过回忆并理解自己早期的童年经历,来获得对潜意识冲突的顿悟.弗洛伊德的疗法被称为“精神分析” (psychoanalysis),在 20 世纪的很长一段时间被心 ...

  4. Fatal signal xx (SIGSEGV) at

    Fatal signal 11问题的解决方法 http://blog.csdn.net/tankai19880619/article/details/9004619 如何定位Android NDK开发 ...

  5. php php-5.6.4.tar.bz2 apache 兼容问题 child pid 27858 exit signal Segmentation fault

    环境 [root envirotar]# uname -a Linux i2..el6.x86_64 # SMP Thu Jul :: UTC x86_64 x86_64 x86_64 GNU/Lin ...

  6. QT 中 关键字讲解(emit,signal,slot)

    Qt中的类库有接近一半是从基类QObject上继承下来,信号与反应槽(signals/slot)机制就是用来在QObject类或其子类间通讯的方法.作为一种通用的处理机制,信号与反应槽非常灵活,可以携 ...

  7. C标准头文件<signal.h>

    信号即异常,或者理解为中断,一个进程接收到一个信号,如果没有处理机制,就会按照默认的处理方式进行处理,而默认的处理方式通常是终止当前进程或忽略该信号.当然,程序也可以编写相应的处理信号的函数,一旦接收 ...

  8. qthread 使用 signal 方法通信

    因为之间尝试过的 signal 机制,都是在 emit singnal_my() 的地方,直接调用了 slot 函数:相当于,slot 只是一个回调函数. 所以,在这里有点困惑,如果是要顺序执行完 s ...

  9. Linux进程间通信(一): 信号 signal()、sigaction()

    一.什么是信号 用过Windows的我们都知道,当我们无法正常结束一个程序时,可以用任务管理器强制结束这个进程,但这其实是怎么实现的呢?同样的功能在Linux上是通过生成信号和捕获信号来实现的,运行中 ...

随机推荐

  1. Symfony2 学习笔记之插件格式

    一个bundle类似于其它框架中的插件,但是比插件表现更好.它跟其它框架最主要的不同是在Symfony2中所有东西都是bundle,包括核心框架功能和你写的所有应用程序代码.Symfony2中,bun ...

  2. Informatica9.6.1在Linux Red Hat 5.8上安装遇到的有关问题整理_3

    3.Repository Service启动后的页面编码问题 1)错误信息: 2)原因分析及解决步骤 原因分析: informatica产品安装背后AdminConsole的Code page默认为U ...

  3. 初学JavaScript(入门一)

    javaScript是世界上最流行的脚本语言   在我们的手机.电脑设备上所浏览的所有网页,以及基于HTML5手机App的交互都是通过javaScript驱动的,所以javascript是前端工作的一 ...

  4. ps做gif love教程(转)

    先看看效果吧: 这是在写部教程的时候,看到一个由方格组成的心.于是试着用PS做成了动画,然后加入了LOVE四个字母,看起来还可以.但是,有些复杂.复杂倒不是技术上的复杂,是做起来复杂. 来试试吧. 1 ...

  5. 新手须知设计的法则 Mark

    经常看到一些讲如何学习设计的文章,坦白讲感觉有些千篇一律.且不痛不痒,都说要看点书.学点画.练软件.多观察……唉,练软件这事还要说么,难道你还需要告诉一个人学开发是需要学习编程语言的? 学习是基于过往 ...

  6. Xcode升级后插件失效的原理与修复办法

    转载:http://joeshang.github.io/2015/04/10/fix-xcode-upgrade-plugin-invalid/ Xcode 的插件大大丰富了 Xcode 的功能,而 ...

  7. CircleLayout

    CircleLayout https://developer.apple.com/library/ios/samplecode/CircleLayout/Introduction/Intro.html ...

  8. freetds链接错误

    用tsql连接mssql出现下面的错误 tsql -H 192.168.1.100 -p 1433 -U sa Password: sa locale is "en_US.UTF-8&quo ...

  9. Cocos本地存储LocalStorage

    HTML5 LocalStorage 本地存储 //存档 var stopResumeMenu4 = cc.MenuItemFont.create("存档", this.onSav ...

  10. 2010“架构师接龙”问答--杨卫华VS赵劼(转)

    add by zhj:虽然是几年前的文章,但还是很有参考价值的 原文:http://blog.zhaojie.me/2010/05/programmer-magazine-2010-5-archite ...