[channels] Abort event wain on abortEvent
This commit is contained in:
parent
ef5f51ba04
commit
b25234da66
@ -132,11 +132,14 @@ static void dumpData(char* data, unsigned length)
|
||||
|
||||
static DWORD WINAPI copyThread(void* data)
|
||||
{
|
||||
DWORD status = WAIT_OBJECT_0;
|
||||
Plugin* plugin = (Plugin*)data;
|
||||
size_t const bufsize = 16 * 1024;
|
||||
|
||||
while (1)
|
||||
while (status == WAIT_OBJECT_0)
|
||||
{
|
||||
|
||||
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
|
||||
DWORD dwRead;
|
||||
char* buffer = malloc(bufsize);
|
||||
|
||||
@ -168,7 +171,9 @@ static DWORD WINAPI copyThread(void* data)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
WaitForSingleObject(plugin->writeComplete, INFINITE);
|
||||
handles[0] = plugin->writeComplete;
|
||||
handles[1] = freerdp_abort_event(plugin->channelEntryPoints.context);
|
||||
status = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
|
||||
ResetEvent(plugin->writeComplete);
|
||||
}
|
||||
|
||||
|
@ -1353,8 +1353,20 @@ static DWORD WINAPI play_thread(LPVOID arg)
|
||||
int rc;
|
||||
wMessage message;
|
||||
wStream* s;
|
||||
HANDLE handle = MessageQueue_Event(rdpsnd->queue);
|
||||
WaitForSingleObject(handle, INFINITE);
|
||||
DWORD status;
|
||||
DWORD nCount = 0;
|
||||
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
|
||||
|
||||
handles[nCount++] = MessageQueue_Event(rdpsnd->queue);
|
||||
handles[nCount++] = freerdp_abort_event(rdpsnd->rdpcontext);
|
||||
status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);
|
||||
switch (status)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
break;
|
||||
default:
|
||||
return ERROR_TIMEOUT;
|
||||
}
|
||||
|
||||
rc = MessageQueue_Peek(rdpsnd->queue, &message, TRUE);
|
||||
if (rc < 1)
|
||||
|
@ -676,7 +676,6 @@ static void terminate_pending_irp_threads(SERIAL_DEVICE* serial)
|
||||
ULONG_PTR id = ids[i];
|
||||
irpThread = ListDictionary_GetItemValue(serial->IrpThreads, (void*)id);
|
||||
TerminateThread(irpThread, 0);
|
||||
|
||||
if (WaitForSingleObject(irpThread, INFINITE) == WAIT_FAILED)
|
||||
{
|
||||
WLog_ERR(TAG, "WaitForSingleObject failed!");
|
||||
|
@ -585,10 +585,21 @@ static DWORD WINAPI tf_debug_channel_thread_func(LPVOID arg)
|
||||
|
||||
while (1)
|
||||
{
|
||||
WaitForSingleObject(context->event, INFINITE);
|
||||
DWORD status;
|
||||
DWORD nCount = 0;
|
||||
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
|
||||
|
||||
if (WaitForSingleObject(context->stopEvent, 0) == WAIT_OBJECT_0)
|
||||
break;
|
||||
handles[nCount++] = context->event;
|
||||
handles[nCount++] = freerdp_abort_event(&context->_p);
|
||||
handles[nCount++] = context->stopEvent;
|
||||
status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);
|
||||
switch (status)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
Stream_SetPosition(s, 0);
|
||||
|
||||
@ -611,7 +622,7 @@ static DWORD WINAPI tf_debug_channel_thread_func(LPVOID arg)
|
||||
Stream_SetPosition(s, BytesReturned);
|
||||
WLog_DBG(TAG, "got %" PRIu32 " bytes", BytesReturned);
|
||||
}
|
||||
|
||||
fail:
|
||||
Stream_Free(s, TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user