|
|
|
@ -2,7 +2,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include <xinu.h> |
|
|
|
#include <xinu.h> |
|
|
|
|
|
|
|
|
|
|
|
void sndch(int nargs, char *args[]); |
|
|
|
void sndch(char); |
|
|
|
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
* main -- example of 2 processes executing the same code concurrently |
|
|
|
* main -- example of 2 processes executing the same code concurrently |
|
|
|
@ -10,18 +10,17 @@ void sndch(int nargs, char *args[]); |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void main(void) |
|
|
|
void main(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
resume( create(sndch, 128, 20, "send A", 1, 'A') ); |
|
|
|
resume( create(sndch, 1024, 20, "send A", 1, 'A') ); |
|
|
|
resume( create(sndch, 128, 20, "send B", 1, 'B') ); |
|
|
|
resume( create(sndch, 1024, 20, "send B", 1, 'B') ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
* sndch -- output a character on a serial device indefinitely |
|
|
|
* sndch -- output a character on a serial device indefinitely |
|
|
|
*------------------------------------------------------------------------ |
|
|
|
*------------------------------------------------------------------------ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void sndch(int nargs, char *args[]) |
|
|
|
void sndch(char ch) |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
char ch = args[0]; /* character to emit continuously */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ( 1 ) |
|
|
|
while ( 1 ) |
|
|
|
putc(CONSOLE, ch); |
|
|
|
putc(CONSOLE, ch); |
|
|
|
|