libfreerdp-utils: purge deprecated wait_obj utils
This commit is contained in:
parent
75a5b755fe
commit
eea3414579
@ -30,7 +30,6 @@
|
|||||||
#include <freerdp/utils/dsp.h>
|
#include <freerdp/utils/dsp.h>
|
||||||
#include <freerdp/utils/thread.h>
|
#include <freerdp/utils/thread.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
#include <freerdp/channels/wtsvc.h>
|
#include <freerdp/channels/wtsvc.h>
|
||||||
#include <freerdp/server/audin.h>
|
#include <freerdp/server/audin.h>
|
||||||
|
|
||||||
@ -276,22 +275,27 @@ static void* audin_server_thread_func(void* arg)
|
|||||||
|
|
||||||
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE)
|
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE)
|
||||||
{
|
{
|
||||||
fd = *((void**)buffer);
|
fd = *((void**) buffer);
|
||||||
WTSFreeMemory(buffer);
|
WTSFreeMemory(buffer);
|
||||||
thread->signals[thread->num_signals++] = wait_obj_new_with_fd(fd);
|
|
||||||
|
thread->signals[thread->num_signals++] = CreateFileDescriptorEvent(NULL, TRUE, FALSE, ((int) (long) fd));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for the client to confirm that the Audio Input dynamic channel is ready */
|
/* Wait for the client to confirm that the Audio Input dynamic channel is ready */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
freerdp_thread_wait(thread);
|
freerdp_thread_wait(thread);
|
||||||
|
|
||||||
if (freerdp_thread_is_stopped(thread))
|
if (freerdp_thread_is_stopped(thread))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualChannelReady, &buffer, &bytes_returned) == FALSE)
|
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualChannelReady, &buffer, &bytes_returned) == FALSE)
|
||||||
break;
|
break;
|
||||||
ready = *((BOOL*)buffer);
|
|
||||||
|
ready = *((BOOL*) buffer);
|
||||||
|
|
||||||
WTSFreeMemory(buffer);
|
WTSFreeMemory(buffer);
|
||||||
|
|
||||||
if (ready)
|
if (ready)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include <freerdp/channels/channels.h>
|
#include <freerdp/channels/channels.h>
|
||||||
#include <freerdp/svc.h>
|
#include <freerdp/svc.h>
|
||||||
#include <freerdp/addin.h>
|
#include <freerdp/addin.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
#include <freerdp/utils/file.h>
|
#include <freerdp/utils/file.h>
|
||||||
#include <freerdp/utils/event.h>
|
#include <freerdp/utils/event.h>
|
||||||
#include <freerdp/utils/debug.h>
|
#include <freerdp/utils/debug.h>
|
||||||
@ -840,7 +839,7 @@ static UINT32 FREERDP_CC MyVirtualChannelWrite(UINT32 openHandle, void* pData, U
|
|||||||
InterlockedPushEntrySList(channels->pSyncDataList, &(item->ItemEntry));
|
InterlockedPushEntrySList(channels->pSyncDataList, &(item->ItemEntry));
|
||||||
|
|
||||||
/* set the event */
|
/* set the event */
|
||||||
wait_obj_set(channels->signal);
|
SetEvent(channels->signal);
|
||||||
|
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
@ -891,7 +890,7 @@ static UINT32 FREERDP_CC MyVirtualChannelEventPush(UINT32 openHandle, RDP_EVENT*
|
|||||||
|
|
||||||
channels->event = event;
|
channels->event = event;
|
||||||
/* set the event */
|
/* set the event */
|
||||||
wait_obj_set(channels->signal);
|
SetEvent(channels->signal);
|
||||||
|
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
@ -935,7 +934,7 @@ rdpChannels* freerdp_channels_new(void)
|
|||||||
InitializeSListHead(channels->pSyncDataList);
|
InitializeSListHead(channels->pSyncDataList);
|
||||||
|
|
||||||
channels->event_sem = CreateSemaphore(NULL, 1, 16, NULL);
|
channels->event_sem = CreateSemaphore(NULL, 1, 16, NULL);
|
||||||
channels->signal = wait_obj_new();
|
channels->signal = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
|
|
||||||
/* Add it to the global list */
|
/* Add it to the global list */
|
||||||
channels_list = (rdpChannelsList*) malloc(sizeof(rdpChannelsList));
|
channels_list = (rdpChannelsList*) malloc(sizeof(rdpChannelsList));
|
||||||
@ -959,7 +958,7 @@ void freerdp_channels_free(rdpChannels* channels)
|
|||||||
_aligned_free(channels->pSyncDataList);
|
_aligned_free(channels->pSyncDataList);
|
||||||
|
|
||||||
CloseHandle(channels->event_sem);
|
CloseHandle(channels->event_sem);
|
||||||
wait_obj_free(channels->signal);
|
CloseHandle(channels->signal);
|
||||||
|
|
||||||
/* Remove from global list */
|
/* Remove from global list */
|
||||||
|
|
||||||
@ -1266,7 +1265,16 @@ static void freerdp_channels_process_sync(rdpChannels* channels, freerdp* instan
|
|||||||
BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds,
|
BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds,
|
||||||
int* read_count, void** write_fds, int* write_count)
|
int* read_count, void** write_fds, int* write_count)
|
||||||
{
|
{
|
||||||
wait_obj_get_fds(channels->signal, read_fds, read_count);
|
int fd;
|
||||||
|
|
||||||
|
fd = GetEventFileDescriptor(channels->signal);
|
||||||
|
|
||||||
|
if (fd != -1)
|
||||||
|
{
|
||||||
|
read_fds[*read_count] = ((void*) (long) fd);
|
||||||
|
(*read_count)++;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1275,9 +1283,9 @@ BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** r
|
|||||||
*/
|
*/
|
||||||
BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance)
|
BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance)
|
||||||
{
|
{
|
||||||
if (wait_obj_is_set(channels->signal))
|
if (WaitForSingleObject(channels->signal, 0) == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
wait_obj_clear(channels->signal);
|
ResetEvent(channels->signal);
|
||||||
freerdp_channels_process_sync(channels, instance);
|
freerdp_channels_process_sync(channels, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include <freerdp/constants.h>
|
#include <freerdp/constants.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
#include <freerdp/utils/svc_plugin.h>
|
||||||
|
|
||||||
#include "dvcman.h"
|
#include "dvcman.h"
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <freerdp/utils/dsp.h>
|
#include <freerdp/utils/dsp.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/thread.h>
|
#include <freerdp/utils/thread.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
#include <freerdp/channels/wtsvc.h>
|
#include <freerdp/channels/wtsvc.h>
|
||||||
#include <freerdp/server/rdpsnd.h>
|
#include <freerdp/server/rdpsnd.h>
|
||||||
|
|
||||||
@ -173,9 +172,10 @@ static void* rdpsnd_server_thread_func(void* arg)
|
|||||||
|
|
||||||
if (WTSVirtualChannelQuery(rdpsnd->rdpsnd_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE)
|
if (WTSVirtualChannelQuery(rdpsnd->rdpsnd_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE)
|
||||||
{
|
{
|
||||||
fd = *((void**)buffer);
|
fd = *((void**) buffer);
|
||||||
WTSFreeMemory(buffer);
|
WTSFreeMemory(buffer);
|
||||||
thread->signals[thread->num_signals++] = wait_obj_new_with_fd(fd);
|
|
||||||
|
thread->signals[thread->num_signals++] = CreateFileDescriptorEvent(NULL, TRUE, FALSE, ((int) (long) fd));
|
||||||
}
|
}
|
||||||
|
|
||||||
s = stream_new(4096);
|
s = stream_new(4096);
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/thread.h>
|
#include <freerdp/utils/thread.h>
|
||||||
#include <freerdp/utils/unicode.h>
|
#include <freerdp/utils/unicode.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
#include <freerdp/channels/rdpdr.h>
|
#include <freerdp/channels/rdpdr.h>
|
||||||
|
|
||||||
typedef struct _SERIAL_DEVICE SERIAL_DEVICE;
|
typedef struct _SERIAL_DEVICE SERIAL_DEVICE;
|
||||||
@ -351,10 +350,10 @@ static void* serial_thread_func(void* arg)
|
|||||||
freerdp_thread_reset(serial->thread);
|
freerdp_thread_reset(serial->thread);
|
||||||
serial_process_irp_list(serial);
|
serial_process_irp_list(serial);
|
||||||
|
|
||||||
if (wait_obj_is_set(serial->in_event))
|
if (WaitForSingleObject(serial->in_event, 0) == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
if (serial_check_fds(serial))
|
if (serial_check_fds(serial))
|
||||||
wait_obj_clear(serial->in_event);
|
ResetEvent(serial->in_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,7 +441,7 @@ static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32
|
|||||||
stream_write_UINT32(irp->output, 0);
|
stream_write_UINT32(irp->output, 0);
|
||||||
irp->Complete(irp);
|
irp->Complete(irp);
|
||||||
|
|
||||||
wait_obj_set(serial->in_event);
|
SetEvent(serial->in_event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +479,7 @@ static void serial_check_for_events(SERIAL_DEVICE* serial)
|
|||||||
irp = (IRP*) list_next(serial->pending_irps, irp);
|
irp = (IRP*) list_next(serial->pending_irps, irp);
|
||||||
list_remove(serial->pending_irps, prev);
|
list_remove(serial->pending_irps, prev);
|
||||||
|
|
||||||
wait_obj_set(serial->in_event);
|
SetEvent(serial->in_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,7 +555,7 @@ static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp)
|
|||||||
|
|
||||||
irp->IoStatus = STATUS_PENDING;
|
irp->IoStatus = STATUS_PENDING;
|
||||||
list_enqueue(serial->pending_irps, irp);
|
list_enqueue(serial->pending_irps, irp);
|
||||||
wait_obj_set(serial->in_event);
|
SetEvent(serial->in_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __serial_check_fds(SERIAL_DEVICE* serial)
|
static void __serial_check_fds(SERIAL_DEVICE* serial)
|
||||||
@ -616,7 +615,7 @@ static void __serial_check_fds(SERIAL_DEVICE* serial)
|
|||||||
if (prev->IoStatus == STATUS_SUCCESS)
|
if (prev->IoStatus == STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
list_remove(serial->pending_irps, prev);
|
list_remove(serial->pending_irps, prev);
|
||||||
wait_obj_set(serial->in_event);
|
SetEvent(serial->in_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -726,9 +725,9 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
|||||||
serial->irp_list = list_new();
|
serial->irp_list = list_new();
|
||||||
serial->pending_irps = list_new();
|
serial->pending_irps = list_new();
|
||||||
serial->thread = freerdp_thread_new();
|
serial->thread = freerdp_thread_new();
|
||||||
serial->in_event = wait_obj_new();
|
serial->in_event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
|
|
||||||
pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*)serial);
|
pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*) serial);
|
||||||
|
|
||||||
freerdp_thread_start(serial->thread, serial_thread_func, serial);
|
freerdp_thread_start(serial->thread, serial_thread_func, serial);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ static void wts_queue_receive_data(rdpPeerChannel* channel, const BYTE* buffer,
|
|||||||
list_enqueue(channel->receive_queue, item);
|
list_enqueue(channel->receive_queue, item);
|
||||||
ReleaseMutex(channel->mutex);
|
ReleaseMutex(channel->mutex);
|
||||||
|
|
||||||
wait_obj_set(channel->receive_event);
|
SetEvent(channel->receive_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wts_queue_send_item(rdpPeerChannel* channel, wts_data_item* item)
|
static void wts_queue_send_item(rdpPeerChannel* channel, wts_data_item* item)
|
||||||
@ -125,7 +125,7 @@ static void wts_queue_send_item(rdpPeerChannel* channel, wts_data_item* item)
|
|||||||
list_enqueue(vcm->send_queue, item);
|
list_enqueue(vcm->send_queue, item);
|
||||||
ReleaseMutex(vcm->mutex);
|
ReleaseMutex(vcm->mutex);
|
||||||
|
|
||||||
wait_obj_set(vcm->send_event);
|
SetEvent(vcm->send_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wts_read_variable_uint(STREAM* s, int cbLen, UINT32 *val)
|
static int wts_read_variable_uint(STREAM* s, int cbLen, UINT32 *val)
|
||||||
@ -184,7 +184,8 @@ static void wts_read_drdynvc_create_response(rdpPeerChannel* channel, STREAM* s,
|
|||||||
DEBUG_DVC("ChannelId %d creation succeeded", channel->channel_id);
|
DEBUG_DVC("ChannelId %d creation succeeded", channel->channel_id);
|
||||||
channel->dvc_open_state = DVC_OPEN_STATE_SUCCEEDED;
|
channel->dvc_open_state = DVC_OPEN_STATE_SUCCEEDED;
|
||||||
}
|
}
|
||||||
wait_obj_set(channel->receive_event);
|
|
||||||
|
SetEvent(channel->receive_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wts_read_drdynvc_data_first(rdpPeerChannel* channel, STREAM* s, int cbLen, UINT32 length)
|
static void wts_read_drdynvc_data_first(rdpPeerChannel* channel, STREAM* s, int cbLen, UINT32 length)
|
||||||
@ -420,7 +421,7 @@ WTSVirtualChannelManager* WTSCreateVirtualChannelManager(freerdp_peer* client)
|
|||||||
ZeroMemory(vcm, sizeof(WTSVirtualChannelManager));
|
ZeroMemory(vcm, sizeof(WTSVirtualChannelManager));
|
||||||
|
|
||||||
vcm->client = client;
|
vcm->client = client;
|
||||||
vcm->send_event = wait_obj_new();
|
vcm->send_event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
vcm->send_queue = list_new();
|
vcm->send_queue = list_new();
|
||||||
vcm->mutex = CreateMutex(NULL, FALSE, NULL);
|
vcm->mutex = CreateMutex(NULL, FALSE, NULL);
|
||||||
vcm->dvc_channel_id_seq = 1;
|
vcm->dvc_channel_id_seq = 1;
|
||||||
@ -452,7 +453,7 @@ void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm)
|
|||||||
vcm->drdynvc_channel = NULL;
|
vcm->drdynvc_channel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_obj_free(vcm->send_event);
|
CloseHandle(vcm->send_event);
|
||||||
|
|
||||||
while ((item = (wts_data_item*) list_dequeue(vcm->send_queue)) != NULL)
|
while ((item = (wts_data_item*) list_dequeue(vcm->send_queue)) != NULL)
|
||||||
{
|
{
|
||||||
@ -468,11 +469,25 @@ void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm)
|
|||||||
void WTSVirtualChannelManagerGetFileDescriptor(WTSVirtualChannelManager* vcm,
|
void WTSVirtualChannelManagerGetFileDescriptor(WTSVirtualChannelManager* vcm,
|
||||||
void** fds, int* fds_count)
|
void** fds, int* fds_count)
|
||||||
{
|
{
|
||||||
wait_obj_get_fds(vcm->send_event, fds, fds_count);
|
int fd;
|
||||||
|
|
||||||
|
fd = GetEventFileDescriptor(vcm->send_event);
|
||||||
|
|
||||||
|
if (fd != -1)
|
||||||
|
{
|
||||||
|
fds[*fds_count] = ((void*) (long) fd);
|
||||||
|
(*fds_count)++;
|
||||||
|
}
|
||||||
|
|
||||||
if (vcm->drdynvc_channel)
|
if (vcm->drdynvc_channel)
|
||||||
{
|
{
|
||||||
wait_obj_get_fds(vcm->drdynvc_channel->receive_event, fds, fds_count);
|
fd = GetEventFileDescriptor(vcm->drdynvc_channel->receive_event);
|
||||||
|
|
||||||
|
if (fd != -1)
|
||||||
|
{
|
||||||
|
fds[*fds_count] = ((void*) (long) fd);
|
||||||
|
(*fds_count)++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,7 +513,7 @@ BOOL WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vcm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_obj_clear(vcm->send_event);
|
ResetEvent(vcm->send_event);
|
||||||
|
|
||||||
WaitForSingleObject(vcm->mutex, INFINITE);
|
WaitForSingleObject(vcm->mutex, INFINITE);
|
||||||
|
|
||||||
@ -546,7 +561,7 @@ void* WTSVirtualChannelOpenEx(
|
|||||||
channel->client = client;
|
channel->client = client;
|
||||||
channel->channel_type = RDP_PEER_CHANNEL_TYPE_DVC;
|
channel->channel_type = RDP_PEER_CHANNEL_TYPE_DVC;
|
||||||
channel->receive_data = stream_new(client->settings->VirtualChannelChunkSize);
|
channel->receive_data = stream_new(client->settings->VirtualChannelChunkSize);
|
||||||
channel->receive_event = wait_obj_new();
|
channel->receive_event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
channel->receive_queue = list_new();
|
channel->receive_queue = list_new();
|
||||||
channel->mutex = CreateMutex(NULL, FALSE, NULL);
|
channel->mutex = CreateMutex(NULL, FALSE, NULL);
|
||||||
|
|
||||||
@ -594,7 +609,7 @@ void* WTSVirtualChannelOpenEx(
|
|||||||
channel->index = i;
|
channel->index = i;
|
||||||
channel->channel_type = RDP_PEER_CHANNEL_TYPE_SVC;
|
channel->channel_type = RDP_PEER_CHANNEL_TYPE_SVC;
|
||||||
channel->receive_data = stream_new(client->settings->VirtualChannelChunkSize);
|
channel->receive_data = stream_new(client->settings->VirtualChannelChunkSize);
|
||||||
channel->receive_event = wait_obj_new();
|
channel->receive_event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
channel->receive_queue = list_new();
|
channel->receive_queue = list_new();
|
||||||
channel->mutex = CreateMutex(NULL, FALSE, NULL);
|
channel->mutex = CreateMutex(NULL, FALSE, NULL);
|
||||||
|
|
||||||
@ -611,6 +626,7 @@ BOOL WTSVirtualChannelQuery(
|
|||||||
/* __out */ void** ppBuffer,
|
/* __out */ void** ppBuffer,
|
||||||
/* __out */ UINT32* pBytesReturned)
|
/* __out */ UINT32* pBytesReturned)
|
||||||
{
|
{
|
||||||
|
int fd;
|
||||||
BOOL bval;
|
BOOL bval;
|
||||||
void* fds[10];
|
void* fds[10];
|
||||||
int fds_count = 0;
|
int fds_count = 0;
|
||||||
@ -620,7 +636,15 @@ BOOL WTSVirtualChannelQuery(
|
|||||||
switch (WtsVirtualClass)
|
switch (WtsVirtualClass)
|
||||||
{
|
{
|
||||||
case WTSVirtualFileHandle:
|
case WTSVirtualFileHandle:
|
||||||
wait_obj_get_fds(channel->receive_event, fds, &fds_count);
|
|
||||||
|
fd = GetEventFileDescriptor(channel->receive_event);
|
||||||
|
|
||||||
|
if (fd != -1)
|
||||||
|
{
|
||||||
|
fds[fds_count] = ((void*) (long) fd);
|
||||||
|
(fds_count)++;
|
||||||
|
}
|
||||||
|
|
||||||
*ppBuffer = malloc(sizeof(void*));
|
*ppBuffer = malloc(sizeof(void*));
|
||||||
memcpy(*ppBuffer, &fds[0], sizeof(void*));
|
memcpy(*ppBuffer, &fds[0], sizeof(void*));
|
||||||
*pBytesReturned = sizeof(void*);
|
*pBytesReturned = sizeof(void*);
|
||||||
@ -682,7 +706,7 @@ BOOL WTSVirtualChannelRead(
|
|||||||
|
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
{
|
{
|
||||||
wait_obj_clear(channel->receive_event);
|
ResetEvent(channel->receive_event);
|
||||||
*pBytesRead = 0;
|
*pBytesRead = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -697,7 +721,7 @@ BOOL WTSVirtualChannelRead(
|
|||||||
list_dequeue(channel->receive_queue);
|
list_dequeue(channel->receive_queue);
|
||||||
|
|
||||||
if (list_size(channel->receive_queue) == 0)
|
if (list_size(channel->receive_queue) == 0)
|
||||||
wait_obj_clear(channel->receive_event);
|
ResetEvent(channel->receive_event);
|
||||||
|
|
||||||
ReleaseMutex(channel->mutex);
|
ReleaseMutex(channel->mutex);
|
||||||
|
|
||||||
@ -825,7 +849,7 @@ BOOL WTSVirtualChannelClose(
|
|||||||
stream_free(channel->receive_data);
|
stream_free(channel->receive_data);
|
||||||
|
|
||||||
if (channel->receive_event)
|
if (channel->receive_event)
|
||||||
wait_obj_free(channel->receive_event);
|
CloseHandle(channel->receive_event);
|
||||||
|
|
||||||
if (channel->receive_queue)
|
if (channel->receive_queue)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/list.h>
|
#include <freerdp/utils/list.h>
|
||||||
#include <freerdp/utils/debug.h>
|
#include <freerdp/utils/debug.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
#include <freerdp/channels/wtsvc.h>
|
#include <freerdp/channels/wtsvc.h>
|
||||||
|
|
||||||
#include <winpr/synch.h>
|
#include <winpr/synch.h>
|
||||||
|
@ -144,7 +144,7 @@ static void searchman_start(USB_SEARCHMAN* self, void* func)
|
|||||||
/* close thread */
|
/* close thread */
|
||||||
static void searchman_close(USB_SEARCHMAN* self)
|
static void searchman_close(USB_SEARCHMAN* self)
|
||||||
{
|
{
|
||||||
wait_obj_set(self->term_event);
|
SetEvent(self->term_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void searchman_list_show(USB_SEARCHMAN* self)
|
static void searchman_list_show(USB_SEARCHMAN* self)
|
||||||
@ -176,7 +176,7 @@ void searchman_free(USB_SEARCHMAN* self)
|
|||||||
|
|
||||||
/* free searchman */
|
/* free searchman */
|
||||||
sem_destroy(&self->sem_term);
|
sem_destroy(&self->sem_term);
|
||||||
wait_obj_free(self->term_event);
|
CloseHandle(self->term_event);
|
||||||
free(self);
|
free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ USB_SEARCHMAN* searchman_new(void * urbdrc, UINT32 UsbDevice)
|
|||||||
searchman->free = searchman_free;
|
searchman->free = searchman_free;
|
||||||
|
|
||||||
searchman->strated = 0;
|
searchman->strated = 0;
|
||||||
searchman->term_event = wait_obj_new();
|
searchman->term_event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
sem_init(&searchman->sem_term, 0, 0);
|
sem_init(&searchman->sem_term, 0, 0);
|
||||||
|
|
||||||
return searchman;
|
return searchman;
|
||||||
|
@ -22,26 +22,27 @@
|
|||||||
#define __SEACH_MAN_H
|
#define __SEACH_MAN_H
|
||||||
|
|
||||||
#include "urbdrc_types.h"
|
#include "urbdrc_types.h"
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
|
|
||||||
typedef struct _USB_SEARCHDEV USB_SEARCHDEV;
|
typedef struct _USB_SEARCHDEV USB_SEARCHDEV;
|
||||||
|
|
||||||
struct _USB_SEARCHDEV
|
struct _USB_SEARCHDEV
|
||||||
{
|
{
|
||||||
void * inode;
|
void* inode;
|
||||||
void * prev;
|
void* prev;
|
||||||
void * next;
|
void* next;
|
||||||
UINT16 idVendor;
|
UINT16 idVendor;
|
||||||
UINT16 idProduct;
|
UINT16 idProduct;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _USB_SEARCHMAN USB_SEARCHMAN;
|
typedef struct _USB_SEARCHMAN USB_SEARCHMAN;
|
||||||
|
|
||||||
struct _USB_SEARCHMAN
|
struct _USB_SEARCHMAN
|
||||||
{
|
{
|
||||||
int usb_numbers;
|
int usb_numbers;
|
||||||
UINT32 UsbDevice;
|
UINT32 UsbDevice;
|
||||||
USB_SEARCHDEV * idev; /* iterator device */
|
USB_SEARCHDEV* idev; /* iterator device */
|
||||||
USB_SEARCHDEV * head; /* head device in linked list */
|
USB_SEARCHDEV* head; /* head device in linked list */
|
||||||
USB_SEARCHDEV * tail; /* tail device in linked list */
|
USB_SEARCHDEV* tail; /* tail device in linked list */
|
||||||
|
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
HANDLE term_event;
|
HANDLE term_event;
|
||||||
@ -49,7 +50,7 @@ struct _USB_SEARCHMAN
|
|||||||
int strated;
|
int strated;
|
||||||
|
|
||||||
/* for urbdrc channel call back */
|
/* for urbdrc channel call back */
|
||||||
void * urbdrc;
|
void* urbdrc;
|
||||||
|
|
||||||
/* load service */
|
/* load service */
|
||||||
void (*rewind) (USB_SEARCHMAN* seachman);
|
void (*rewind) (USB_SEARCHMAN* seachman);
|
||||||
@ -71,7 +72,7 @@ struct _USB_SEARCHMAN
|
|||||||
void (*free) (USB_SEARCHMAN* searchman);
|
void (*free) (USB_SEARCHMAN* searchman);
|
||||||
};
|
};
|
||||||
|
|
||||||
USB_SEARCHMAN * searchman_new(void * urbdrc, UINT32 UsbDevice);
|
USB_SEARCHMAN* searchman_new(void* urbdrc, UINT32 UsbDevice);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <libudev.h>
|
#include <libudev.h>
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/synch.h>
|
||||||
#include <winpr/cmdline.h>
|
#include <winpr/cmdline.h>
|
||||||
|
|
||||||
#include <freerdp/dvc.h>
|
#include <freerdp/dvc.h>
|
||||||
@ -474,7 +475,7 @@ static void* urbdrc_search_usb_device(void* arg)
|
|||||||
|
|
||||||
/* Get the file descriptor (fd) for the monitor.
|
/* Get the file descriptor (fd) for the monitor.
|
||||||
This fd will get passed to select() */
|
This fd will get passed to select() */
|
||||||
mon_fd = wait_obj_new_with_fd((void*) (size_t) udev_monitor_get_fd(mon));
|
mon_fd = CreateFileDescriptorEvent(NULL, TRUE, FALSE, udev_monitor_get_fd(mon));
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -488,15 +489,16 @@ static void* urbdrc_search_usb_device(void* arg)
|
|||||||
listobj[0] = searchman->term_event;
|
listobj[0] = searchman->term_event;
|
||||||
listobj[1] = mon_fd;
|
listobj[1] = mon_fd;
|
||||||
numobj = 2;
|
numobj = 2;
|
||||||
wait_obj_select(listobj, numobj, -1);
|
|
||||||
|
|
||||||
if (wait_obj_is_set(searchman->term_event))
|
WaitForMultipleObjects(numobj, listobj, FALSE, INFINITE);
|
||||||
|
|
||||||
|
if (WaitForSingleObject(searchman->term_event, 0) == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
sem_post(&searchman->sem_term);
|
sem_post(&searchman->sem_term);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wait_obj_is_set(mon_fd))
|
if (WaitForSingleObject(mon_fd, 0) == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
dev = udev_monitor_receive_device(mon);
|
dev = udev_monitor_receive_device(mon);
|
||||||
|
|
||||||
@ -570,11 +572,11 @@ static void* urbdrc_search_usb_device(void* arg)
|
|||||||
numobj = 1;
|
numobj = 1;
|
||||||
timeout = 4000; /* milliseconds */
|
timeout = 4000; /* milliseconds */
|
||||||
|
|
||||||
wait_obj_select(listobj, numobj, timeout);
|
WaitForMultipleObjects(numobj, listobj, FALSE, timeout);
|
||||||
|
|
||||||
if (wait_obj_is_set(searchman->term_event))
|
if (WaitForSingleObject(searchman->term_event, 0) == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
wait_obj_free(mon_fd);
|
CloseHandle(mon_fd);
|
||||||
sem_post(&searchman->sem_term);
|
sem_post(&searchman->sem_term);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -626,16 +628,16 @@ static void* urbdrc_search_usb_device(void* arg)
|
|||||||
numobj = 1;
|
numobj = 1;
|
||||||
timeout = 3000; /* milliseconds */
|
timeout = 3000; /* milliseconds */
|
||||||
|
|
||||||
wait_obj_select(listobj, numobj, timeout);
|
WaitForMultipleObjects(numobj, listobj, FALSE, timeout);
|
||||||
|
|
||||||
if (wait_obj_is_set(searchman->term_event))
|
if (WaitForSingleObject(searchman->term_event, 0) == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
wait_obj_free(mon_fd);
|
CloseHandle(mon_fd);
|
||||||
sem_post(&searchman->sem_term);
|
sem_post(&searchman->sem_term);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pdev && on_close && dvc_channel && pdev->isSigToEnd(pdev) && !(pdev->isChannelClosed(pdev)))
|
if (pdev && on_close && dvc_channel && pdev->isSigToEnd(pdev) && !(pdev->isChannelClosed(pdev)))
|
||||||
{
|
{
|
||||||
on_close = 0;
|
on_close = 0;
|
||||||
dvc_channel->Close(dvc_channel);
|
dvc_channel->Close(dvc_channel);
|
||||||
@ -644,13 +646,14 @@ static void* urbdrc_search_usb_device(void* arg)
|
|||||||
|
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
printf("No Device from receive_device(). An error occured.\n");
|
printf("No Device from receive_device(). An error occured.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_obj_free(mon_fd);
|
CloseHandle(mon_fd);
|
||||||
sem_post(&searchman->sem_term);
|
sem_post(&searchman->sem_term);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
/**
|
|
||||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
||||||
* Virtual Channel Manager
|
|
||||||
*
|
|
||||||
* Copyright 2009-2011 Jay Sorg
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __WAIT_OBJ_UTILS
|
|
||||||
#define __WAIT_OBJ_UTILS
|
|
||||||
|
|
||||||
#include <freerdp/api.h>
|
|
||||||
|
|
||||||
FREERDP_API HANDLE wait_obj_new(void);
|
|
||||||
FREERDP_API HANDLE wait_obj_new_with_fd(void* fd);
|
|
||||||
FREERDP_API void wait_obj_free(HANDLE event);
|
|
||||||
FREERDP_API int wait_obj_is_set(HANDLE event);
|
|
||||||
FREERDP_API void wait_obj_set(HANDLE event);
|
|
||||||
FREERDP_API void wait_obj_clear(HANDLE event);
|
|
||||||
FREERDP_API int wait_obj_select(HANDLE* events, int count, int timeout);
|
|
||||||
FREERDP_API void wait_obj_get_fds(HANDLE event, void** fds, int* count);
|
|
||||||
|
|
||||||
#endif
|
|
@ -36,7 +36,6 @@ typedef struct rdp_ntlm_http rdpNtlmHttp;
|
|||||||
#include <freerdp/settings.h>
|
#include <freerdp/settings.h>
|
||||||
#include <freerdp/crypto/tls.h>
|
#include <freerdp/crypto/tls.h>
|
||||||
#include <freerdp/crypto/crypto.h>
|
#include <freerdp/crypto/crypto.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
#include <freerdp/utils/sleep.h>
|
#include <freerdp/utils/sleep.h>
|
||||||
#include <freerdp/utils/debug.h>
|
#include <freerdp/utils/debug.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
|
@ -61,7 +61,6 @@ typedef struct
|
|||||||
#include <freerdp/settings.h>
|
#include <freerdp/settings.h>
|
||||||
#include <freerdp/crypto/tls.h>
|
#include <freerdp/crypto/tls.h>
|
||||||
#include <freerdp/crypto/crypto.h>
|
#include <freerdp/crypto/crypto.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
#include <freerdp/utils/sleep.h>
|
#include <freerdp/utils/sleep.h>
|
||||||
#include <freerdp/utils/debug.h>
|
#include <freerdp/utils/debug.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/synch.h>
|
||||||
|
|
||||||
#include <freerdp/utils/tcp.h>
|
#include <freerdp/utils/tcp.h>
|
||||||
#include <freerdp/utils/sleep.h>
|
#include <freerdp/utils/sleep.h>
|
||||||
@ -354,7 +355,7 @@ int transport_write(rdpTransport* transport, STREAM* s)
|
|||||||
{
|
{
|
||||||
/* and in case we do have buffered some data, we set the event so next loop will get it */
|
/* and in case we do have buffered some data, we set the event so next loop will get it */
|
||||||
if (transport_read_nonblocking(transport) > 0)
|
if (transport_read_nonblocking(transport) > 0)
|
||||||
wait_obj_set(transport->recv_event);
|
SetEvent(transport->recv_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,6 +374,8 @@ int transport_write(rdpTransport* transport, STREAM* s)
|
|||||||
|
|
||||||
void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount)
|
void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount)
|
||||||
{
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
rfds[*rcount] = transport->TcpIn->wsa_event;
|
rfds[*rcount] = transport->TcpIn->wsa_event;
|
||||||
(*rcount)++;
|
(*rcount)++;
|
||||||
@ -392,7 +395,14 @@ void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount)
|
|||||||
(*rcount)++;
|
(*rcount)++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wait_obj_get_fds(transport->recv_event, rfds, rcount);
|
|
||||||
|
fd = GetEventFileDescriptor(transport->recv_event);
|
||||||
|
|
||||||
|
if (fd != -1)
|
||||||
|
{
|
||||||
|
rfds[*rcount] = ((void*) (long) fd);
|
||||||
|
(*rcount)++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int transport_check_fds(rdpTransport** ptransport)
|
int transport_check_fds(rdpTransport** ptransport)
|
||||||
@ -406,7 +416,7 @@ int transport_check_fds(rdpTransport** ptransport)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WSAResetEvent(transport->TcpIn->wsa_event);
|
WSAResetEvent(transport->TcpIn->wsa_event);
|
||||||
#endif
|
#endif
|
||||||
wait_obj_clear(transport->recv_event);
|
ResetEvent(transport->recv_event);
|
||||||
|
|
||||||
status = transport_read_nonblocking(transport);
|
status = transport_read_nonblocking(transport);
|
||||||
|
|
||||||
@ -496,7 +506,7 @@ int transport_check_fds(rdpTransport** ptransport)
|
|||||||
/* one at a time but set event if data buffered
|
/* one at a time but set event if data buffered
|
||||||
* so the main loop will call freerdp_check_fds asap */
|
* so the main loop will call freerdp_check_fds asap */
|
||||||
if (stream_get_pos(transport->recv_buffer) > 0)
|
if (stream_get_pos(transport->recv_buffer) > 0)
|
||||||
wait_obj_set(transport->recv_event);
|
SetEvent(transport->recv_event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +539,7 @@ rdpTransport* transport_new(rdpSettings* settings)
|
|||||||
|
|
||||||
/* receive buffer for non-blocking read. */
|
/* receive buffer for non-blocking read. */
|
||||||
transport->recv_buffer = stream_new(BUFFER_SIZE);
|
transport->recv_buffer = stream_new(BUFFER_SIZE);
|
||||||
transport->recv_event = wait_obj_new();
|
transport->recv_event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
|
|
||||||
/* buffers for blocking read/write */
|
/* buffers for blocking read/write */
|
||||||
transport->recv_stream = stream_new(BUFFER_SIZE);
|
transport->recv_stream = stream_new(BUFFER_SIZE);
|
||||||
@ -550,7 +560,7 @@ void transport_free(rdpTransport* transport)
|
|||||||
stream_free(transport->recv_buffer);
|
stream_free(transport->recv_buffer);
|
||||||
stream_free(transport->recv_stream);
|
stream_free(transport->recv_stream);
|
||||||
stream_free(transport->send_stream);
|
stream_free(transport->send_stream);
|
||||||
wait_obj_free(transport->recv_event);
|
CloseHandle(transport->recv_event);
|
||||||
|
|
||||||
if (transport->TlsIn)
|
if (transport->TlsIn)
|
||||||
tls_free(transport->TlsIn);
|
tls_free(transport->TlsIn);
|
||||||
|
@ -41,7 +41,6 @@ typedef struct rdp_transport rdpTransport;
|
|||||||
#include <freerdp/types.h>
|
#include <freerdp/types.h>
|
||||||
#include <freerdp/settings.h>
|
#include <freerdp/settings.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
|
|
||||||
typedef BOOL (*TransportRecv) (rdpTransport* transport, STREAM* stream, void* extra);
|
typedef BOOL (*TransportRecv) (rdpTransport* transport, STREAM* stream, void* extra);
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ typedef struct rdp_tsg rdpTsg;
|
|||||||
#include <freerdp/types.h>
|
#include <freerdp/types.h>
|
||||||
#include <freerdp/settings.h>
|
#include <freerdp/settings.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
#include <freerdp/utils/debug.h>
|
#include <freerdp/utils/debug.h>
|
||||||
|
|
||||||
enum _TSG_STATE
|
enum _TSG_STATE
|
||||||
|
@ -39,8 +39,7 @@ set(${MODULE_PREFIX}_SRCS
|
|||||||
thread.c
|
thread.c
|
||||||
time.c
|
time.c
|
||||||
uds.c
|
uds.c
|
||||||
unicode.c
|
unicode.c)
|
||||||
wait_obj.c)
|
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} msusb.c)
|
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} msusb.c)
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
/**
|
|
||||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
||||||
* Virtual Channel Manager
|
|
||||||
*
|
|
||||||
* Copyright 2009-2011 Jay Sorg
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
|
||||||
#include <winpr/synch.h>
|
|
||||||
#include <winpr/windows.h>
|
|
||||||
|
|
||||||
#include <freerdp/utils/wait_obj.h>
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HANDLE wait_obj_new(void)
|
|
||||||
{
|
|
||||||
return CreateEvent(NULL, TRUE, FALSE, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
HANDLE wait_obj_new_with_fd(void* fd)
|
|
||||||
{
|
|
||||||
return CreateFileDescriptorEvent(NULL, TRUE, FALSE, ((int) (long) fd));
|
|
||||||
}
|
|
||||||
|
|
||||||
void wait_obj_free(HANDLE event)
|
|
||||||
{
|
|
||||||
CloseHandle(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
int wait_obj_is_set(HANDLE event)
|
|
||||||
{
|
|
||||||
return (WaitForSingleObject(event, 0) == WAIT_OBJECT_0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wait_obj_set(HANDLE event)
|
|
||||||
{
|
|
||||||
SetEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wait_obj_clear(HANDLE event)
|
|
||||||
{
|
|
||||||
ResetEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
int wait_obj_select(HANDLE* events, int count, int timeout)
|
|
||||||
{
|
|
||||||
if (WaitForMultipleObjects(count, events, FALSE, timeout) == WAIT_FAILED)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wait_obj_get_fds(HANDLE event, void** fds, int* count)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
fd = GetEventFileDescriptor(event);
|
|
||||||
|
|
||||||
if (fd == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fds[*count] = ((void*) (long) fd);
|
|
||||||
|
|
||||||
(*count)++;
|
|
||||||
}
|
|
@ -31,6 +31,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/synch.h>
|
||||||
|
|
||||||
#include <freerdp/constants.h>
|
#include <freerdp/constants.h>
|
||||||
#include <freerdp/utils/sleep.h>
|
#include <freerdp/utils/sleep.h>
|
||||||
@ -406,9 +407,9 @@ static void* tf_debug_channel_thread_func(void* arg)
|
|||||||
|
|
||||||
if (WTSVirtualChannelQuery(context->debug_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE)
|
if (WTSVirtualChannelQuery(context->debug_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE)
|
||||||
{
|
{
|
||||||
fd = *((void**)buffer);
|
fd = *((void**) buffer);
|
||||||
WTSFreeMemory(buffer);
|
WTSFreeMemory(buffer);
|
||||||
thread->signals[thread->num_signals++] = wait_obj_new_with_fd(fd);
|
thread->signals[thread->num_signals++] = CreateFileDescriptorEvent(NULL, TRUE, FALSE, ((int) (long) fd));
|
||||||
}
|
}
|
||||||
|
|
||||||
s = stream_new(4096);
|
s = stream_new(4096);
|
||||||
|
Loading…
Reference in New Issue
Block a user