a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Libraries:
 exec.library
  AVL_AddNode
  AVL_FindFirstNode
  AVL_FindLastNode
  AVL_FindNextNodeByAddress
  AVL_FindNextNodeByKey
  AVL_FindNode
  AVL_FindPrevNodeByAddress
  AVL_FindPrevNodeByKey
  AVL_RemNodeByAddress
  AVL_RemNodeByKey
  AbortIO
  AddDevice
  AddHead
  AddIntServer
  AddLibrary
  AddMemHandler
  AddMemList
  AddPort
  AddResource
  AddSemaphore
  AddTail
  AddTask
  Alert
  AllocAbs
  AllocEntry
  AllocMem
  AllocPooled
  AllocSignal
  AllocTrap
  AllocVec
  Allocate
  AttemptSemaphore
  AttemptSemaphoreShared
  AvailMem
  CacheClearE
  CacheClearU
  CacheControl
  CachePostDMA
  CachePreDMA
  Cause
  CheckIO
  CloseDevice
  CloseLibrary
  ColdReboot
  CopyMem
  CopyMemQuick
  CreateIORequest
  CreateMsgPort
  CreatePool
  Deallocate
  Debug
  DeleteIORequest
  DeleteMsgPort
  DeletePool
  Disable
  DoIO
  Enable
  Enqueue
  FindName
  FindPort
  FindResident
  FindSemaphore
  FindTask
  Forbid
  FreeEntry
  FreeMem
  FreePooled
  FreeSignal
  FreeTrap
  FreeVec
  GetCC
  GetMsg
  InitCode
  InitResident
  InitSemaphore
  InitStruct
  Insert
  MakeFunctions
  MakeLibrary
  ObtainQuickVector
  ObtainSemaphore
  ObtainSemaphoreList
  ObtainSemaphoreShared
  OldOpenLibrary
  OpenDevice
  OpenLibrary
  OpenResource
  Permit
  Procure
  PutMsg
  RawDoFmt
  ReleaseSemaphore
  ReleaseSemaphoreList
  RemDevice
  RemHead
  RemIntServer
  RemLibrary
  RemMemHandler
  RemPort
  RemResource
  RemSemaphore
  RemTail
  RemTask
  Remove
  ReplyMsg
  SendIO
  SetExcept
  SetFunction
  SetIntVector
  SetSR
  SetSignal
  SetTaskPri
  Signal
  StackSwap
  SumKickData
  SumLibrary
  SuperState
  Supervisor
  TypeOfMem
  UserState
  Vacate
  Wait
  WaitIO
  WaitPort
Include
GuruMeditation
Docs » Autodocs » exec.library » AddMemHandler

NAME

	AddMemHandler - Add a low memory handler to exec                 (V39)

SYNOPSIS

	AddMemHandler(memHandler)
A1
VOID AddMemHandler(struct Interrupt *);

FUNCTION

	This function adds a low memory handler to the system.  The handler
is described in the Interrupt structure. Due to multitasking
issues, the handler must be ready to run the moment this function
call is made. (The handler may be called before the call returns)

NOTES

	Adding a handler from within a handler will cause undefined
actions. It is safe to add a handler to the list while within
a handler but the newly added handler may or may not be called
for the specific failure currently running.

EXAMPLE

	struct Interrupt *myInt;  /* Assume it is allocated */
myInt->is_Node.ln_Pri=50; /* Relatively early; before RAMLIB */
/* Please fill in the name field! */
myInt->is_Node.ln_Name="Example Handler";
myInt->is_Data=(APTR)mydata_pointer;
myInt->is_Code=myhandler_code;
AddMemHandler(myInt);
... /* and so on */
_myhandler_code:
; This is the handler code
; We are passed a pointer to struct MemHandlerData
; in a0, the value of is_Data in a1 and
; ExecBase in a6.
; We must not break forbid!!!
;
; Start off assuming we did nothing
;
moveq.l #MEM_DID_NOTHING,d0
move.l memh_RequestFlags(a0),d1
btst.l #MEMB_CHIP,d1 ; Did the failure happen in CHIP
beq.s handler_nop ; If not, we have nothing to do
bsr DoMyMagic ; Do the magic...
; DoMyMagic frees whatever we can and returns d0 set...
handler_nop:
rts ; Return with d0 set...

INPUTS

	memHandler - A pointer to a completely filled in Interrupt structure
The priority field determine the position of the handler
with respect to other handlers in the system. The higher
the priority, the earlier the handler is called.
Positive priorities will have the handler called before
any of the library expunge vectors are called. Negative
priority handlers will be called after the library
expunge routines are called.
(Note: RAMLIB is a handler at priority 0)

SEE ALSO

RemMemHandler(), "exec/interrupts.i"

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Tristar & Red Sector Inc.

SPB
AYS
TRSI
PHA

Comments:

$VER: d0.se 1.14 Copyright © 2011-2020 Tobias Geijersson support at d0 dot se