r4722@vps: verhaegs | 2007-05-06 13:11:19 -0400
[cake.git] / rom / dos / lockdoslist.c
blob3406ebc1416f3faffa3f5b0f7d5cbe2e05596c70
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include "dos_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <proto/dos.h>
16 AROS_LH1(struct DosList *, LockDosList,
18 /* SYNOPSIS */
19 AROS_LHA(ULONG, flags, D1),
21 /* LOCATION */
22 struct DosLibrary *, DOSBase, 109, Dos)
24 /* FUNCTION
25 Waits until the desired dos lists are free then gets a lock on them.
26 A handle is returned that can be used for FindDosEntry().
27 Calls to this function nest, i.e. you must call UnLockDosList()
28 as often as you called LockDosList(). Always lock all lists
29 at once - do not try to get a lock on one of them then on another.
31 INPUTS
32 flags - what lists to lock
34 RESULT
35 Handle to the dos list. This is not a direct pointer
36 to the first list element but to a pseudo element instead.
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 *****************************************************************************/
50 AROS_LIBFUNC_INIT
51 if(flags&LDF_WRITE)
52 ObtainSemaphore(&DOSBase->dl_DosListLock);
53 else
54 ObtainSemaphoreShared(&DOSBase->dl_DosListLock);
55 return (struct DosList *)&DOSBase->dl_DevInfo;
56 AROS_LIBFUNC_EXIT
57 } /* LockDosList */