tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / rom / exec / addmemhandler.c
blob00050c5a3b7877a4dbbfeb047160d1dac6cf35f0
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a low memory handler.
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
12 #include <proto/exec.h>
14 #include "exec_intern.h"
16 /*****************************************************************************
18 NAME */
20 AROS_LH1(void, AddMemHandler,
22 /* SYNOPSIS */
23 AROS_LHA(struct Interrupt *, memHandler, A1),
25 /* LOCATION */
26 struct ExecBase *, SysBase, 129, Exec)
28 /* FUNCTION
29 Add some function to be called if the system is low on memory.
31 INPUTS
32 memHandler - An Interrupt structure to add to the low memory
33 handler list.
35 RESULT
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
45 INTERNALS
47 ******************************************************************************/
49 AROS_LIBFUNC_INIT
50 ASSERT_VALID_PTR(memHandler);
52 /* Protect the low memory handler list */
53 ObtainSemaphore(&PrivExecBase(SysBase)->LowMemSem);
55 /* Nothing spectacular: Just add the new node */
56 Enqueue((struct List *)&SysBase->ex_MemHandlers,&memHandler->is_Node);
58 ReleaseSemaphore(&PrivExecBase(SysBase)->LowMemSem);
60 AROS_LIBFUNC_EXIT
61 } /* AddMemHandler */