From: take@wadalab.t.u-tokyo.ac.jp (Mikio Takeuchi)
Newsgroups: fj.comp.parallel
Subject: Re: why does transputer(c)'s i/o function busywaiting?
Date: 26 Jan 93 10:03:37 GMT
	<NITTA.93Jan25233312@ns.c.u-tokyo.ac.jp>
Reply-To: take@wadalab.t.u-tokyo.ac.jp
Distribution: fj
Organization: Wada Lab., Dept. of Information Engineering, University of Tokyo,
	Japan

$@ElBg$NC]Fb$G$9!#?7ED$5$s!"$*5W$7$V$j$G$9!#(J

$@65$($F$$$?$@$$$?J}K!$r;n$7$F$_$^$7$?!#35$M$&$^$/F0$$$F$$$k$N$G$9$,!"$$(J
$@$/$D$+LdBjE@$,=P$F$-$^$7$?!#(J

$@$^$:$O(Jpollkey()$@$O(JCTRL-C$@$bDL>o$N%5!<%P$KBP$9$k3d$j9~$_$G$O$J$/$F(J3$@$rJV$7(J
$@$F$7$^$&E@$G$9!#$3$l$O(Jfgetc_poll()$@$NCf$G%A%'%C%/$9$k$3$H$GBP=h$G$-$^$9(J
$@$+$i<B$O$"$^$jLdBj$G$O$"$j$^$;$s!#(J

$@$b$&0l$D$NLdBj$O!"(Jpollkey()$@$rMQ$$$k$H!"(J\n$@$N07$$$,JQ$o$C$F$7$^$&E@$G$9!#(J

$@Nc$($P<!$N%W%m%0%i%`!"!J(Jfgets_poll.c$@$O5-;v$+$i@Z$jH4(J$@$$$?$=$N$^$^$G$9!K(J
#include <stdio.h>
#include <process.h>
#include "fgets_poll.c"

void recv(Process *self)
{
	char	buf[256];
	self = self;
	while (1)
		/*gets(buf);*/
		fgets_poll(buf,256,stdin);
}

void send(Process *self)
{
	char	*msg = "This is send\nhoehoe";
	self = self;
	while (1) {
		puts(msg);
		fflush(stdout);
	}
}

int main(void)
{
	Process *p0, *p1;
	char	*msg = "This is main\nhoehoe";

	puts(msg);
	p0 = ProcAlloc(send, 0, 0);
	p1 = ProcAlloc(recv, 0, 0);
	ProcRun(p1);
	ProcRun(p0);

	while (1)
		ProcReschedule();
	return 1;
}

$@$r<B9T$9$k$HF@$i$l$k7k2L$O<!$N$h$&$K$J$j$^$9!#(J
$@!J%3%s%=!<%k(J$@$X$N=PNO$r(Jscript(1)$@$GC%$C$F!"(Jod -c$@$G%@%s%W$7$?$b$N$G$9!#!K(J

0000000    S   c   r   i   p   t       s   t   a   r   t   e   d       o
0000020    n       T   u   e       J   a   n       2   6       1   8   :
0000040    4   8   :   3   8       1   9   9   3  \n   t   a   k   e   @
0000060    s   h   i   g   e   [   1   ]   %       i   s   e   r   v   e
0000100    r       -   s   b       i   o   .   b   t   l  \r  \r  \n   B
0000120    o   o   t   i   n   g       r   o   o   t       t   r   a   n
0000140    s   p   u   t   e   r   .   .   .   |  \b   /  \b   -  \b   \
0000160   \b  \r                                                        
0000200                                                       \r   T   h
0000220    i   s       i   s       m   a   i   n  \r  \n   h   o   e   h
                                                $@!v$3$3$H!v(J
0000240    o   e  \r  \n   T   h   i   s       i   s       s   e   n   d
0000260   \n   h   o   e   h   o   e  \n   f   T   h   i   s       i   s
     $@!v$3$3$G$9(J$@!v(J
0000300        s   e   n   d  \n   h   o   e   h   o   e  \n   o   T   h
0000320    i   s       i   s       s   e   n   d  \n   h   o   e   h   o
0000340    e  \n   o   T   h   i   s       i   s       s   e   n   d  \n
0000360    h   o   e   h   o   e  \n  \n   T   h   i   s       i   s    
0000400    s   e   n   d  \n   h   o   e   h   o   e  \n   b   T   h   i
0000420    s       i   s       s   e   n   d  \n   h   o   e   h   o   e
0000440   \n   a   T   h   i   s       i   s       s   e   n   d  \n   h
0000460    o   e   h   o   e  \n   r   T   h   i   s       i   s       s
0000500    e   n   d  \n   h   o   e   h   o   e  \n  \n   T   h   i   s
0000520        i   s       s   e   n   d  \n   h   o   e   h   o   e  \n
0000540  003   T   h   i   s       i   s       s   e   n   d  \n   h   o
   $@!v$3$3$O(JCTRL-C$@!v(J
0000560    e   h   o   e  \n 003   T   e   r   m   i   n   a   t   e   d
0000600   \n   t   a   k   e   @   s   h   i   g   e   [   2   ]   %    
0000620    e   x   i   t  \r  \r  \n   e   x   i   t  \r  \n  \n   s   c
0000640    r   i   p   t       d   o   n   e       o   n       T   u   e
0000660        J   a   n       2   6       1   8   :   4   9   :   3   5
0000700        1   9   9   3  \n  \n   s   c   r   i   p   t       d   o
0000720    n   e       o   n       T   u   e       J   a   n       2   6
0000740        1   8   :   4   9   :   3   5       1   9   9   3  \n
0000757

$@MW$9$k$K!"(Jpollkey()$@$r;H$&$H:#$^$G(J\n$@$G(J\r\n$@$N%7!<%1%s%9$,=PNO$5$l$F$$$?(J
$@$N$,(J\n$@$@$1$7$+=PNO$5$l$J$/$J$C(J$@$F$7$^$&$N$G$9!#(Jprintf, puts. putc$@$J$I$,(J
$@A4$F1F6A$r$&$1$k$_$?$$$J$N$G!"A4It=q$-49$($k$N$O$A$g$C$H%7%s(J$@%I%$$G$9!#(J
$@:#$3$NLdBj$KHq$d$7$F$$$k;~4V$,$"$^$j$J$$$N$G!"$^$?2K$K$J$C$?$i$d$j$?$$(J
$@$H;W$$$^$9!#(J

$@$I$&$b(J$@M-Fq$&$4$6$$$^$7$?!#(J
--
// $@El5~Bg3XBg3X1!9)3X7O8&5f2J(J $@7W?t9)3X@l96(J $@C]Fb44M:(J