| M E M _ A D D E X H A N D L E R ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
AMIGA - MEM_#?
----------------------------------------------------------------------------
NAME
mem_addexhandler() - Allows programmer to have multiple
exception routines in a single task.
SYNOPSIS
sigbit = mem_addexhandler(presig, usercode, userdata);
LONG mem_addexhandler(LONG, void *, void *);
FUNCTION
This function installs exception code in such a way that
the exception mechanism become in-exclusive, so user can
call some code per signal.
INPUTS
presig - Preallocated signal(sigbit) or -1 for auto
allocated one.
usercode - User exception routine. It must follow the
very same rules as denoted in 'RKM'.
userdata - User general purpose data pointer.
RETURNS
Function returns signal number that can be then used to
call the exception handler. That value is also used to
identify the handler itself.
BASES
SysBase
NOTES
Exception handlers can be freed in any order. Also sigs
can be manipulated without restrictions.
Installing exception handler of this family on top of the
unrelated one is possible. It will be wrapped. You must
remember tho not to touch 'tc_ExceptCode'/'tc_ExceptData'
after doing so!
There can be 16 user handlers with automatically allocated
signals maximally, because there is only 16 free signals
per task.
Never pass pointer to the data that are on stack! You can
either 'static' it or just allocate the memory and put it
there. Reason for this is that when you call the init func
in a nested call and then go back that data is gone!
You must not call 'CreateProcTags()' in exception handler,
but you can call 'CreateTask()'.
Do not call functions that operate on critical data nor
use arbitration or allocate something exclusively!!!
Exception may cause short stack shrinkage, since it does
put whole context in there! Make sure that you do not use
more than a half of your stack space to be on the safe
side.
General rule is: one signal == one exception. This means
that two signals that reference same exception code will
cause two calls! But, unrelated exception handler (the one
that was in 'tc_ExceptCode' before first call to this f.)
will behave the old way and will be triggered once for all
signals that has just arrived!
SEE ALSO
mem_remexhandler(), mem_attachsniffer(),
mem_detachsniffer()
EXAMPLE
See source code of 'a-mem_xxxifh.c' for a practical use.
BUGS
None known.
----------------------------------------------------------------------------
| |
| |