ReactOS  0.4.15-dev-1070-ge1a01de
events.c File Reference
#include "precomp.h"
Include dependency graph for events.c:

Go to the source code of this file.

Classes

struct  _CTEBLOCK_EVENT
 
struct  _CTE_DELAYED_EVENT
 

Typedefs

typedef struct _CTEBLOCK_EVENT CTEBLOCK_EVENT
 
typedef struct _CTEBLOCK_EVENTPCTEBLOCK_EVENT
 
typedef void(* CTE_WORKER_ROUTINE) (struct _CTE_DELAYED_EVENT *, void *Context)
 
typedef struct _CTE_DELAYED_EVENT CTE_DELAYED_EVENT
 
typedef struct _CTE_DELAYED_EVENTPCTE_DELAYED_EVENT
 

Functions

NTSTATUS NTAPI CTEBlock (PCTEBLOCK_EVENT Block)
 
VOID NTAPI InternalWorker (IN PVOID Parameter)
 
VOID NTAPI CTEInitEvent (PCTE_DELAYED_EVENT Event, CTE_WORKER_ROUTINE Routine)
 
NTSTATUS NTAPI CTELogEvent (ULONG Unknown0, ULONG Unknown1, ULONG Unknown2, ULONG Unknown3, ULONG Unknown4, ULONG Unknown5, ULONG Unknown6)
 
BOOLEAN NTAPI CTEScheduleEvent (PCTE_DELAYED_EVENT Event, PVOID Context)
 
LONG NTAPI CTESignal (PCTEBLOCK_EVENT Block, NTSTATUS Status)
 

Typedef Documentation

◆ CTE_DELAYED_EVENT

◆ CTE_WORKER_ROUTINE

typedef void(* CTE_WORKER_ROUTINE) (struct _CTE_DELAYED_EVENT *, void *Context)

Definition at line 20 of file events.c.

◆ CTEBLOCK_EVENT

◆ PCTE_DELAYED_EVENT

◆ PCTEBLOCK_EVENT

Function Documentation

◆ CTEBlock()

NTSTATUS NTAPI CTEBlock ( PCTEBLOCK_EVENT  Block)

Definition at line 38 of file events.c.

39 {
41 
42  /* Perform the wait */
44 
45  /* Update event status if wait was not successful */
46  if (!NT_SUCCESS(Status)) Block->Status = Status;
47 
48  return Block->Status;
49 }
NTSTATUS Status
Definition: events.c:15
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
KEVENT Event
Definition: events.c:16

◆ CTEInitEvent()

VOID NTAPI CTEInitEvent ( PCTE_DELAYED_EVENT  Event,
CTE_WORKER_ROUTINE  Routine 
)

Definition at line 79 of file events.c.

81 {
82  /* Init the structure, lock and a work item */
83  Event->Queued = FALSE;
85  Event->WorkerRoutine = Routine;
87 }
#define FALSE
Definition: types.h:117
VOID NTAPI InternalWorker(IN PVOID Parameter)
Definition: events.c:54
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265

◆ CTELogEvent()

NTSTATUS NTAPI CTELogEvent ( ULONG  Unknown0,
ULONG  Unknown1,
ULONG  Unknown2,
ULONG  Unknown3,
ULONG  Unknown4,
ULONG  Unknown5,
ULONG  Unknown6 
)

Definition at line 94 of file events.c.

103 {
104  /* Probably call
105  * IoAllocateErrorLogEntry and
106  * IoWriteErrorLogEntry
107  */
108  return STATUS_NOT_IMPLEMENTED;
109 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

◆ CTEScheduleEvent()

BOOLEAN NTAPI CTEScheduleEvent ( PCTE_DELAYED_EVENT  Event,
PVOID  Context 
)

Definition at line 117 of file events.c.

119 {
120  KIRQL OldIrql;
121 
122  /* Acquire the lock */
123  KeAcquireSpinLock(&Event->Lock, &OldIrql);
124 
125  /* Make sure it is queued */
126  if (!Event->Queued)
127  {
128  /* Mark it as queued and set optional context pointer */
129  Event->Queued = TRUE;
130  Event->Context = Context;
131 
132  /* Actually queue it */
134  }
135 
136  /* Release the lock */
138 
139  return TRUE;
140 }
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:717
#define TRUE
Definition: types.h:120
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
struct tagContext Context
Definition: acpixf.h:1034

◆ CTESignal()

LONG NTAPI CTESignal ( PCTEBLOCK_EVENT  Block,
NTSTATUS  Status 
)

Definition at line 148 of file events.c.

149 {
150  /* Set status right away */
151  Block->Status = Status;
152 
153  /* Set the event */
154  return KeSetEvent(&Block->Event, IO_NO_INCREMENT, FALSE);
155 }
NTSTATUS Status
Definition: events.c:15
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:24
KEVENT Event
Definition: events.c:16
#define IO_NO_INCREMENT
Definition: iotypes.h:581

◆ InternalWorker()

VOID NTAPI InternalWorker ( IN PVOID  Parameter)

Definition at line 54 of file events.c.

55 {
57  KIRQL OldIrql;
58 
59  /* Acquire the lock */
61 
62  /* Make sure it is queued */
63  ASSERT(Event->Queued);
64  Event->Queued = FALSE;
65 
66  /* Release the lock */
68 
69  /* Call the real worker routine */
70  (*Event->WorkerRoutine)(Event, Event->Context);
71 }
struct _CTE_DELAYED_EVENT * PCTE_DELAYED_EVENT
_In_ PVOID Parameter
Definition: ldrtypes.h:241
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627

Referenced by CTEInitEvent().