2 * reactos events emulation of libcaptive
3 * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
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
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.
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
22 #include "reactos/ddk/kefuncs.h" /* self */
23 #include <glib/gmessages.h>
24 #include "reactos/ddk/exfuncs.h" /* for InterlockedExchange() */
29 * @Event: Event to initialize.
30 * %NULL value is forbidden.
31 * @Type: %NotificationEvent or %SynchronizationEvent.
32 * @State: Initial signal state.
34 * Initalizes a kernel event. Currently libcaptive doesn't use multithreading
35 * and thus this function is a NOP now.
37 VOID KeInitializeEvent(PKEVENT Event,EVENT_TYPE Type,BOOLEAN State)
39 g_return_if_fail(Event!=NULL);
40 g_return_if_fail(Type==NotificationEvent || Type==SynchronizationEvent);
48 * @Event: Event to set its signal state on.
49 * %NULL value is forbidden.
50 * @Increment: Thread priority increase during wait; ignored by libcaptive.
51 * @Wait: Do not release locks, KeWait() is required afterwards; ignored by libcaptive.
53 * Sets the signal state of @Event. Currently libcaptive doesn't use multithreading
54 * and thus this function will just set the @Event's internal state and it returns
56 * See also KeResetEvent(), KeClearEvent().
58 * Returns: Previous signal state value of @Event.
60 LONG KeSetEvent(PKEVENT Event,KPRIORITY Increment,BOOLEAN Wait)
62 g_return_val_if_fail(Event!=NULL,0);
65 return InterlockedExchange(&(Event->Header.SignalState),1);
71 * @Event: Event to clear its signal state off.
72 * %NULL value is forbidden.
74 * Clears the signal state of @Event. See also KeSetEvent().
75 * Use KeClearEvent() if you do not need the previous signal state of @Event.
77 * Returns: Previous signal state value of @Event.
79 LONG KeResetEvent(PKEVENT Event)
81 g_return_val_if_fail(Event!=NULL,0);
83 return InterlockedExchange(&(Event->Header.SignalState),0);
89 * @Event: Event to clear its signal state off.
90 * %NULL value is forbidden.
92 * Clears the signal state of @Event. See also KeSetEvent().
93 * Use KeResetEvent() if you need the previous signal state of @Event.
95 VOID KeClearEvent(PKEVENT Event)
97 g_return_if_fail(Event!=NULL);
99 Event->Header.SignalState=FALSE;