+libcaptive/halcaptive/queuedspinlock.c
[captive.git] / src / libcaptive / halcaptive / queuedspinlock.c
1 /* $Id$
2  * reactos queued spinlock emulation of libcaptive
3  * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; exactly version 2 of June 1991 is required
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 #include "config.h"
21
22 /* no reactos prototype for KeAcquireQueuedSpinLock() and KeReleaseQueuedSpinLock() */
23 #include "reactos/ddk/types.h"  /* for KIRQL */
24 #include "reactos/ddk/kefuncs.h"        /* for KeGetCurrentIrql() */
25
26
27 typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
28         LockQueueDispatcherLock,
29         LockQueueContextSwapLock,
30         LockQueuePfnLock,
31         LockQueueSystemSpaceLock,
32         LockQueueVacbLock,
33         LockQueueMasterLock,
34         LockQueueNonPagedPoolLock,
35         LockQueueIoCancelLock,
36         LockQueueWorkQueueLock,
37         LockQueueIoVpbLock,
38         LockQueueIoDatabaseLock,
39         LockQueueIoCompletionLock,
40         LockQueueNtfsStructLock,
41         LockQueueAfdWorkQueueLock,
42         LockQueueBcbLock,
43         LockQueueMaximumLock
44         } KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
45
46
47 /**
48  * KeAcquireQueuedSpinLock:
49  * @Number: Identification number of queued spinlock to acquire.
50  *
51  * Acquires a queued spinlock identified by @Number.
52  * Currently libcaptive doesn't use multithreading
53  * and thus this function is a NOP now. #GMutex would be needed otherwise.
54  *
55  * See http://www.compuware.co.jp/drivercentral/resources/spinlocks.asp
56  *
57  * Returns: IRQ level before this call. FIXME: What is expected in real? No W32 doc...
58  */
59 KIRQL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER Number)
60 {
61         /* TODO:thread */
62
63         return KeGetCurrentIrql();
64 }
65
66
67 /**
68  * KeReleaseQueuedSpinLock:
69  * @Number: Identification number of queued spinlock to release.
70  * @OldIrql: Original IRQ level before KeAcquireQueuedSpinLock().
71  *
72  * Releases a queued spinlock acquired by KeAcquireQueuedSpinLock().
73  * Currently libcaptive doesn't use multithreading
74  * and thus this function is a NOP now. #GMutex would be needed otherwise.
75  */
76 VOID KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER Number,IN KIRQL OldIrql)
77 {
78         /* TODO:thread */
79 }