Minor fixes to comments.
[AROS.git] / rom / oop / findclass.c
blobd1934453a02d75cb1431014d29735ca36eda6ac7
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id:$
5 Desc: Find a public OOP class
6 Lang: english
7 */
9 #include <exec/lists.h>
10 #include <proto/exec.h>
12 #include "intern.h"
13 #include "hash.h"
15 #define MD(x) ((struct metadata *)x)
17 /*****************************************************************************
19 NAME */
20 #include <proto/oop.h>
22 AROS_LH1(APTR, OOP_FindClass,
24 /* SYNOPSIS */
25 AROS_LHA(CONST_STRPTR, classID, A0),
27 /* LOCATION */
28 struct Library *, OOPBase, 22, OOP)
30 /* FUNCTION
31 Finds a class with given ID in the list of public classes.
33 INPUTS
34 classID - Public ID of the class to find.
36 RESULT
37 Pointer to a public class or NULL if there's no such class
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 OOP_AddClass()
48 INTERNALS
50 HISTORY
51 V42 - initial implementation
53 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 OOP_Class *classPtr;
60 /* Class list is public, so we must avoid race conditions */
61 ObtainSemaphoreShared(&GetOBase(OOPBase)->ob_ClassListLock);
63 classPtr = (OOP_Class *)FindName((struct List *)&(GetOBase(OOPBase)->ob_ClassList), classID);
65 /* Release lock on list */
66 ReleaseSemaphore(&GetOBase(OOPBase)->ob_ClassListLock);
68 return classPtr;
70 AROS_LIBFUNC_EXIT