Ai
1 Star 0 Fork 1

forest_555/skyeye_rawos

forked from hehe/skyeye_rawos 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test_sem.c 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
嵌入式-老费 提交于 2014-06-30 00:17 +08:00 . add all rawos files
#include <raw_api.h>
#define TEST_TASK_STK_SIZE 1024
static RAW_TASK_OBJ test_task_obj[2];
static PORT_STACK test_task_stack1[TEST_TASK_STK_SIZE];
static PORT_STACK test_task_stack2[TEST_TASK_STK_SIZE];
static RAW_SEMAPHORE s1;
static void test_task1(void * pParam)
{
while(1) {
raw_semaphore_get(&s1, RAW_WAIT_FOREVER);
__put_char("give ", 5);
raw_sleep(2);
}
}
static void test_task2(void * pParam)
{
while(1) {
raw_semaphore_put(&s1);
__put_char("get ", 4);
raw_sleep(100);
}
}
extern int test_switch;
void test_sem()
{
if(1 == test_switch) {
return;
}
test_switch = 1;
raw_semaphore_create(&s1, "sem1", 0);
raw_task_create(&test_task_obj[0], (RAW_U8 *)"task1", 0,
5, 10, test_task_stack1,
TEST_TASK_STK_SIZE , test_task1, 1);
raw_task_create(&test_task_obj[1], (RAW_U8 *)"task2", 0,
5, 10, test_task_stack2,
TEST_TASK_STK_SIZE , test_task2, 1);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/forest555/skyeye_rawos.git
git@gitee.com:forest555/skyeye_rawos.git
forest555
skyeye_rawos
skyeye_rawos
master

搜索帮助