Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / commodities / enqueuecxobj.c
blob0185f05d0a209b0325c5080280a66c1e4d50ab81
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*****************************************************************************
11 NAME */
13 #include "cxintern.h"
14 #include <proto/exec.h>
15 #include <proto/commodities.h>
16 #include <libraries/commodities.h>
18 AROS_LH2(VOID, EnqueueCxObj,
20 /* SYNOPSIS */
22 AROS_LHA(CxObj *, headObj, A0),
23 AROS_LHA(CxObj *, co , A1),
25 /* LOCATION */
27 struct Library *, CxBase, 15, Commodities)
29 /* FUNCTION
31 Insert commodity object 'co' into the list of objects connected to
32 'headObj' according to the priority of 'co'. (The priority of an object
33 can be set by the function SetCxObjPri().)
35 INPUTS
37 headObj - the object to which 'co' shall be inserted.
38 co - a pointer to a commodity object
40 RESULT
42 If 'headObj' is NULL, the object 'co' and all objects connected to it
43 are deleted. If 'co' is NULL and 'headObj' is a valid object, the
44 latter's accumulated error will be adjusted to incorporate
45 COERR_NULLATTACH.
47 NOTES
49 For nodes with equal priority, this function inserts object like within
50 a FIFO queue.
52 EXAMPLE
54 BUGS
56 SEE ALSO
58 SetCxObjPri(), CxObjError(), ClearCxObjError(),
59 <libraries/commodities.h>
61 INTERNALS
63 HISTORY
65 *****************************************************************************/
68 AROS_LIBFUNC_INIT
70 if (headObj == NULL)
72 DeleteCxObjAll(co);
74 return;
77 if (co == NULL)
79 headObj->co_Error |= COERR_NULLATTACH;
81 return;
84 ObtainSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
86 Enqueue((struct List *)&headObj->co_ObjList, &co->co_Node);
87 co->co_Flags |= COF_VALID;
89 ReleaseSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
91 AROS_LIBFUNC_EXIT
92 } /* EnqueueCxObj */