Added event name to handle.
This commit is contained in:
parent
55e9132fa4
commit
71924958bd
@ -74,11 +74,9 @@ static int EventGetFd(HANDLE handle)
|
||||
return event->pipe_fd[0];
|
||||
}
|
||||
|
||||
static BOOL EventCloseHandle(HANDLE handle)
|
||||
static BOOL EventCloseHandle_(WINPR_EVENT* event)
|
||||
{
|
||||
WINPR_EVENT* event = (WINPR_EVENT*) handle;
|
||||
|
||||
if (!EventIsHandled(handle))
|
||||
if (!event)
|
||||
return FALSE;
|
||||
|
||||
if (!event->bAttached)
|
||||
@ -96,10 +94,21 @@ static BOOL EventCloseHandle(HANDLE handle)
|
||||
}
|
||||
}
|
||||
|
||||
free(event->name);
|
||||
free(event);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL EventCloseHandle(HANDLE handle)
|
||||
{
|
||||
WINPR_EVENT* event = (WINPR_EVENT*) handle;
|
||||
|
||||
if (!EventIsHandled(handle))
|
||||
return FALSE;
|
||||
|
||||
return EventCloseHandle_(event);
|
||||
}
|
||||
|
||||
static HANDLE_OPS ops =
|
||||
{
|
||||
EventIsHandled,
|
||||
@ -154,6 +163,9 @@ HANDLE CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset,
|
||||
if (!event)
|
||||
return NULL;
|
||||
|
||||
if (lpName)
|
||||
event->name = strdup(lpName);
|
||||
|
||||
event->bAttached = FALSE;
|
||||
event->bManualReset = bManualReset;
|
||||
event->ops = &ops;
|
||||
@ -185,7 +197,7 @@ HANDLE CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset,
|
||||
|
||||
return (HANDLE)event;
|
||||
fail:
|
||||
free(event);
|
||||
EventCloseHandle_(event);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ typedef struct winpr_semaphore WINPR_SEMAPHORE;
|
||||
struct winpr_event
|
||||
{
|
||||
WINPR_HANDLE_DEF();
|
||||
char* name;
|
||||
|
||||
int pipe_fd[2];
|
||||
BOOL bAttached;
|
||||
|
Loading…
Reference in New Issue
Block a user