Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / datatypes / lockdatatype.c
blob4a322f4c38982966b0323a58970f626b927a99a3
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include "datatypes_intern.h"
10 #include <datatypes/datatypes.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
16 #include <proto/datatypes.h>
18 AROS_LH1(VOID, LockDataType,
20 /* SYNOPSIS */
21 AROS_LHA(struct DataType *, dt, A0),
23 /* LOCATION */
24 struct Library *, DataTypesBase, 40, DataTypes)
26 /* FUNCTION
28 Lock a DataType structure obtained from ObtainDataTypeA() or a data type
29 object (DTA_DataType).
31 INPUTS
33 dt -- DataType structure; may be NULL
35 RESULT
37 NOTES
39 Calls to LockDataType() and ObtainDataTypeA() must have a corresponding
40 ReleaseDataType() call or else problems will arise.
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 ObtainDataTypeA(), ReleaseDataType()
50 INTERNALS
52 HISTORY
54 2.8.99 SDuvan implemented
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 if(dt == NULL || dt->dtn_Length == 0)
61 return;
63 ObtainSemaphoreShared(&(GPB(DataTypesBase)->dtb_DTList)->dtl_Lock);
65 ((struct CompoundDataType *)dt)->OpenCount++;
67 ReleaseSemaphore(&(GPB(DataTypesBase)->dtb_DTList)->dtl_Lock);
69 AROS_LIBFUNC_EXIT
70 } /* LockDataType */