home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
066.lha
/
ttasks.txt
< prev
next >
Wrap
Text File
|
1986-11-20
|
2KB
|
35 lines
/* `TTalk' - Talking Tasks
* -programming example using messages and ports
* (C)1987 Transactor Publishing Inc.
* From Transactor Magazine, written by Chris Zamara, May 1987
* ---->>This program may be freely distributed<<----
*
* This code shows you how to create and find message ports, and how
* to send, receive, and reply to messages.
*
* This program, `TTalk', lets you create several named DOS windows, and send
* messages between them. Just give each task its name when you run it
* from the CLI, e.g. "run TTalk Fred". If you start another task,
* like "run TTalk Edna", you can send Edna a message from Fred by typing
* into Fred's window something like, "Edna, you look lovely today!"
* Edna will receive the message and print it in her window. Any number
* of these tasks can be started, and any one can talk to any other.
*
* How it works: A message port is created and given the name that the user
* supplies (the name in the window title). To send a message to another task,
* its port is found with FindPort(), a message is sent to the port with
* PutMsg(), and a reply is waited for with WaitPort(). Within the message is
* a pointer to the text that the user wanted to send. The receiving task
* uses GetMsg() in between waiting for the keypresses to receive the message.
* All talking tasks also have access to a public port called "Joe's Cafe",
* where they read a message saying how many talking tasks are running, and
* update the message when they are started and ended. By talking at Joe"s
* Cafe, the talking tasks can determine a good place to put their window so
* that the user doesn't have to always move around overlapping windows. The
* first task started creates the "Joe's Cafe" port and the first message
* there, and the last task ended deletes them.
*
* compiled with Manx Aztec 3.40a, should work with Lattice as well.
*/