static void* jni_channels_thread(void* arg) { int status; HANDLE event; rdpChannels* channels; freerdp* instance = (freerdp*) arg; assert(NULL != instance); DEBUG_ANDROID("Channels_thread Start."); channels = instance->context->channels; event = freerdp_channels_get_event_handle(instance); while (WaitForSingleObject(event, INFINITE) == WAIT_OBJECT_0) { status = freerdp_channels_process_pending_messages(instance); if (!status) break; } DEBUG_ANDROID("channels_thread Quit."); ExitThread(0); return NULL; }
DWORD freerdp_get_event_handles(rdpContext* context, HANDLE* events, DWORD count) { DWORD nCount = 0; nCount += transport_get_event_handles(context->rdp->transport, events, count); if (nCount == 0) return 0; if (events && (nCount < count + 2)) { events[nCount++] = freerdp_channels_get_event_handle(context->instance); events[nCount++] = getChannelErrorEventHandle(context); events[nCount++] = context->abortEvent; } else return 0; if (context->settings->AsyncInput) { if (nCount >= count) return 0; events[nCount++] = freerdp_get_message_queue_event_handle( context->instance, FREERDP_INPUT_MESSAGE_QUEUE); } return nCount; }
void* rds_channels_thread(void* arg) { int status; DWORD nCount; rdsContext* rds; HANDLE events[8]; rdpChannels* channels; freerdp* instance = (freerdp*) arg; rds = (rdsContext*) instance->context; channels = instance->context->channels; nCount = 0; events[nCount++] = rds->StopEvent; events[nCount++] = freerdp_channels_get_event_handle(instance); while (1) { WaitForMultipleObjects(nCount, events, FALSE, INFINITE); if (WaitForSingleObject(rds->StopEvent, 0) == WAIT_OBJECT_0) { break; } status = freerdp_channels_process_pending_messages(instance); if (!status) break; } ExitThread(0); return NULL; }
UINT32 freerdp_get_event_handles(rdpContext* context, HANDLE* events) { UINT32 nCount = 0; nCount += transport_get_event_handles(context->rdp->transport, events); if (events) events[nCount] = freerdp_channels_get_event_handle(context->instance); nCount++; return nCount; }
DWORD freerdp_get_event_handles(rdpContext* context, HANDLE* events, DWORD count) { DWORD nCount = 0; nCount += transport_get_event_handles(context->rdp->transport, events, count); if (nCount == 0) return 0; if (events && (nCount < count)) events[nCount++] = freerdp_channels_get_event_handle(context->instance); else return 0; return nCount; }