-
Notifications
You must be signed in to change notification settings - Fork 0
/
Delegate.h
33 lines (27 loc) · 868 Bytes
/
Delegate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef _DELEGATE_HEADER_
#define _DELEGATE_HEADER_
typedef struct
{
List Handlers;
UInt16 RemainingAsync;
} DelegateInternal;
typedef void (*DelegateHandler)(void* arg);
typedef struct
{
// Execute the delegate on the current thread
Int16 (*Invoke)(UInt16 handle, void* arg);
// Execute the delegate on separate system worker threads
Int16 (*InvokeAsync)(UInt16 handle, void* arg);
// Add a handler proc to be executed whenever the delegate is executed.
Int16 (*AddHandler)(UInt16 handle, DelegateHandler handler);
// Removes a previously added handler from the internal list of handlers.
Int16 (*RemoveHandler)(UInt16 handle, DelegateHandler handler);
} IDelegate;
typedef struct
{
DelegateHandler Handler;
void* Arg;
DelegateInternal* DelegateObj;
} DelegateAsyncQueueItem;
void InitializeDelegates(void);
#endif