Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / commodities / attachcxobj.c
blob3e3f696b6a494b0f2632111a7a3b86bd2afdea18
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 <libraries/commodities.h>
15 #include <proto/exec.h>
16 #include <proto/commodities.h>
18 AROS_LH2(VOID, AttachCxObj,
20 /* SYNOPSIS */
22 AROS_LHA(CxObj *, headObj, A0),
23 AROS_LHA(CxObj *, co, A1),
25 /* LOCATION */
27 struct Library *, CxBase, 14, Commodities)
29 /* FUNCTION
31 Add commodity object 'co' last in the list of objects of object
32 'headObj'.
34 INPUTS
36 headObj - pointer to a list of commodity objects
37 co - the object to add to the list
40 RESULT
42 If 'headObj' is NULL the entire tree of objects pointed to by 'co'
43 is deleted. If 'co' is NULL, this is recorded in the error field of
44 'headObj'.
46 NOTES
48 EXAMPLE
50 BUGS
52 SEE ALSO
54 CxObjError(), ClearCxObjError()
56 INTERNALS
58 HISTORY
60 ******************************************************************************/
63 AROS_LIBFUNC_INIT
65 if (headObj == NULL)
67 DeleteCxObjAll(co);
69 return;
72 if (co == NULL)
74 headObj->co_Error |= COERR_NULLATTACH;
76 return;
79 ObtainSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
81 AddTail((struct List *)&headObj->co_ObjList, &co->co_Node);
82 co->co_Flags |= COF_VALID;
84 ReleaseSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
86 AROS_LIBFUNC_EXIT
87 } /* AttachCxObject */