home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d500
/
signal.lha
/
Signal
/
Signal.doc
< prev
next >
Wrap
Text File
|
1991-06-06
|
3KB
|
75 lines
OVERVIEW:
SIGNAL and WAITFOR are companion programs designed to make it easy to write
script files that use RUN EXECUTE to start other script files. Often one
EXECUTE script must be synchronised with the operation of another (in order to
avaid disk thrashing, for instance). AmigaDOS does not provide a convenient
mechanism for accomplishing this (one must use FAILAT and WAIT in one process
and BREAK in the other; this requires that one process know the task number of
the parent, and there is no easy way to do this). SIGNAL and WAITFOR provide
such a synchronization mechanism.
HOW TO USE SIGNAL AND WAITFOR:
In order to avoid the problem of one task having to know the task number of
the other, WAITFOR and SIGNAL provide "named" signals; that is, the two
processes communicate by using agreed-upon names. For example, if the
main process included the commands:
RUN EXECUTE SubProcess.COM
WAITFOR OK-Signal
ECHO "Sub-Process Complete."
and SubProcess.COM contained:
ECHO "Sub-Process Doing its Work."
SIGNAL OK-Signal
then the RUN command would start the second process running, and the WAITFOR
would block until the second process performed the SIGNAL command. Thus the
output would be:
Sub-Process Doing its Work.
Sub-Process Complete.
The genereal form of the commands are:
WAITFOR <name>
SIGNAL <name>
where <name> is any string of characters. WAITFOR <name> will only complete
when a corresponding SIGNAL <name> is executed. Note that capitalization and
spacing (except for leading spaces) are not ignored. The same name can not be
used by more than two processes at once (one SIGNAL and WAITFOR pair), but by
using different names, many processes can be linked together at one time.
There is no mechanism currently in WAITFOR to allow a process to wait for
more than one signal at once.
Both WAITFOR and SIGNAL can be cancelled by the user pressing CTRL-C (or using
the BREAK command from DOS).
If the SIGNAL command happens to be executed BEFORE the WAITFOR command,
SIGNAL will attempt to signal again every 2 seconds for 20 seconds. If no
WAITFOR command has been performed within that time, SIGNAL will exit with an
error status.
The files MainProcess.COM and SubProcess.COM included in the distribution
show a complete example of how to use SIGNAL and WAITFOR to synchronize
process activity. To see them in action, issue the command:
1> EXECUTE MAINPROCESS.COM
AUTHOR:
Signal and WaitFor
Copyright (c) 1989 by Davide P. Cervone, all rights reserved.
Davide P. Cervone
Department of Mathematics, Box 1917 ST402523@BROWNVM.BITNET
Brown University st402523@brownvm.brown.edu
Providence, Rhode Island 02912 dpvc@fermat.math.brown.edu