forked from ShariKing/FuzzyBunnies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProcessP.c
49 lines (38 loc) · 1.19 KB
/
ProcessP.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include "rtx.h"
// pseudocode for kbd input -> crt output passing process
void processP()
{
struct msgenv* env = (struct msgenv *) malloc (sizeof (struct msgenv));
env->msg_type = (char*)malloc (sizeof (SIZE));
env->msg_text = (char*)malloc (sizeof (SIZE));
if (env){
//now enter infinite loop
while (1) {
get_console_chars(env); //keyboard input
env = receive_message(); //***STOPS HERE TO WAIT FOR INPUT
while (env == NULL) {
usleep(100000);
env = receive_message();
}
send_console_chars(env); //CRT output, wait for ack
env = receive_message();
while (env == NULL) {
usleep (100000);
env = receive_message();
}
}
}
}