User guide
1.2. A CINTPOS CONSOLE SESSION 9
Notice that the root CLI (task 1) completes the execution of the run com m a n d
and issues a prompt (0.000 1>) before the newly created CLI (task 7) has had
time to load and run the status command. As soon as task 7 finishes running
the status command it commits suicide leaving the o ri g inal 6 tasks.
The bounce.b program provides a demonstration of communication between
Cintpos tasks work.
0.000 1> type com/bounce.b
SECTION "bounce"
GET "libhdr"
LET start() BE qpkt(taskwait()) REPEAT
0.000 1>
It can be compiled and r u n as follows.
0.000 1> c bc bounce
bcpl com/bounce.b to cin/bounce hdrs POSHDRS
BCPL (20 Oct 2009)
Code size = 60 bytes
0.010 1> run bounce
0.000 1> status
Task 1: Root_Cli running CLI Loaded command: status
Task 2: Debug_Task waiting DEBUG
Task 3: Console_Handler waiting COHAND
Task 4: File_Handler waiting FH0
Task 5: MBX_Handler waiting MBXHAND
Task 6: TCP_Handler waiting TCPHAND
Task 7: Run_Cli waiting CLI Loaded command: bounce
0.000 1>
The status output shows that the bounce program is running as task 7 and is
suspended in taskwait waiting for another task to send it a packet. When it
receives a packet it immediately returns it to the sender and waits for another to
arrive. We can send a suitabl e packet to bounce using the send command whose
source code is as follows.
0.000 1> type com/send.b
SECTION "send"
GET "libhdr"
GLOBAL { task: 200; count: 201 }
LET start() BE
{ LET pkt = VEC 2
LET argv = VEC 50
UNLESS rdargs("TASK/n,COUNT/n", argv, 50) DO
{ writef("Bad arguments for SEND*n")
stop(20)