📄 share.c
字号:
/* share.c - Tasks #3, 4, and 5 */#include <psos.h>#include <prepc.h>#include <stdio.h>#include "misc.h"#include "appl.h"void main_loop(ULONG me, ULONG tid, ULONG ev, ULONG qid){ ULONG rc; struct message in; char str[256]; bprintf("%s Task begin\n", me); do { /* Tell tsk1 we are ready */ if (0 != (rc = ev_send(tid, ev))) fail(rc, "%s: ev_send(0x%x)", me, tid); /* Then receive the broadcast */ if (0 != (rc = q_receive(qid, 0, 0, (ULONG *) &in))) fail(rc, "%s: q_receive()", me); bprintf("%s: received ", (char *) me); if (in.flag == FALSE) bprintf("FALSE: "); else bprintf("TRUE: "); str[0]='\0'; strncat(str, (char *) &(in.data), sizeof(in.data)); bprintf("%s\n", str); } while (in.flag == FALSE); /* Report we've seen the final message */ if (0 != (rc = ev_send(tid, ev))) fail(rc, "%s: ev_send(0x%x)", me, tid); bprintf("%s Task end\n", (char *) me); exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -