cliprdr/server: make channel thread optional
This commit is contained in:
parent
afce8061b3
commit
265e8b9e9d
@ -986,12 +986,15 @@ static void* cliprdr_server_thread(void* arg)
|
|||||||
DWORD status;
|
DWORD status;
|
||||||
DWORD nCount;
|
DWORD nCount;
|
||||||
HANDLE events[8];
|
HANDLE events[8];
|
||||||
|
HANDLE ChannelEvent;
|
||||||
CliprdrServerContext* context = (CliprdrServerContext*) arg;
|
CliprdrServerContext* context = (CliprdrServerContext*) arg;
|
||||||
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle;
|
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle;
|
||||||
|
|
||||||
|
ChannelEvent = context->GetEventHandle(context);
|
||||||
|
|
||||||
nCount = 0;
|
nCount = 0;
|
||||||
events[nCount++] = cliprdr->StopEvent;
|
events[nCount++] = cliprdr->StopEvent;
|
||||||
events[nCount++] = cliprdr->ChannelEvent;
|
events[nCount++] = ChannelEvent;
|
||||||
|
|
||||||
cliprdr_server_init(context);
|
cliprdr_server_init(context);
|
||||||
|
|
||||||
@ -1004,9 +1007,10 @@ static void* cliprdr_server_thread(void* arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cliprdr_server_read(context) < 0)
|
if (WaitForSingleObject(ChannelEvent, 0) == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
break;
|
if (context->CheckEventHandle(context) < 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1098,6 +1102,17 @@ static int cliprdr_server_stop(CliprdrServerContext* context)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HANDLE cliprdr_server_get_event_handle(CliprdrServerContext* context)
|
||||||
|
{
|
||||||
|
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle;
|
||||||
|
return cliprdr->ChannelEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cliprdr_server_check_event_handle(CliprdrServerContext* context)
|
||||||
|
{
|
||||||
|
return cliprdr_server_read(context);
|
||||||
|
}
|
||||||
|
|
||||||
CliprdrServerContext* cliprdr_server_context_new(HANDLE vcm)
|
CliprdrServerContext* cliprdr_server_context_new(HANDLE vcm)
|
||||||
{
|
{
|
||||||
CliprdrServerContext* context;
|
CliprdrServerContext* context;
|
||||||
@ -1111,6 +1126,8 @@ CliprdrServerContext* cliprdr_server_context_new(HANDLE vcm)
|
|||||||
context->Close = cliprdr_server_close;
|
context->Close = cliprdr_server_close;
|
||||||
context->Start = cliprdr_server_start;
|
context->Start = cliprdr_server_start;
|
||||||
context->Stop = cliprdr_server_stop;
|
context->Stop = cliprdr_server_stop;
|
||||||
|
context->GetEventHandle = cliprdr_server_get_event_handle;
|
||||||
|
context->CheckEventHandle = cliprdr_server_check_event_handle;
|
||||||
|
|
||||||
context->ServerCapabilities = cliprdr_server_capabilities;
|
context->ServerCapabilities = cliprdr_server_capabilities;
|
||||||
context->MonitorReady = cliprdr_server_monitor_ready;
|
context->MonitorReady = cliprdr_server_monitor_ready;
|
||||||
|
@ -37,6 +37,8 @@ typedef int (*psCliprdrOpen)(CliprdrServerContext* context);
|
|||||||
typedef int (*psCliprdrClose)(CliprdrServerContext* context);
|
typedef int (*psCliprdrClose)(CliprdrServerContext* context);
|
||||||
typedef int (*psCliprdrStart)(CliprdrServerContext* context);
|
typedef int (*psCliprdrStart)(CliprdrServerContext* context);
|
||||||
typedef int (*psCliprdrStop)(CliprdrServerContext* context);
|
typedef int (*psCliprdrStop)(CliprdrServerContext* context);
|
||||||
|
typedef HANDLE (*psCliprdrGetEventHandle)(CliprdrServerContext* context);
|
||||||
|
typedef int (*psCliprdrCheckEventHandle)(CliprdrServerContext* context);
|
||||||
|
|
||||||
typedef int (*psCliprdrServerCapabilities)(CliprdrServerContext* context, CLIPRDR_CAPABILITIES* capabilities);
|
typedef int (*psCliprdrServerCapabilities)(CliprdrServerContext* context, CLIPRDR_CAPABILITIES* capabilities);
|
||||||
typedef int (*psCliprdrClientCapabilities)(CliprdrServerContext* context, CLIPRDR_CAPABILITIES* capabilities);
|
typedef int (*psCliprdrClientCapabilities)(CliprdrServerContext* context, CLIPRDR_CAPABILITIES* capabilities);
|
||||||
@ -68,6 +70,8 @@ struct _cliprdr_server_context
|
|||||||
psCliprdrClose Close;
|
psCliprdrClose Close;
|
||||||
psCliprdrStart Start;
|
psCliprdrStart Start;
|
||||||
psCliprdrStop Stop;
|
psCliprdrStop Stop;
|
||||||
|
psCliprdrGetEventHandle GetEventHandle;
|
||||||
|
psCliprdrCheckEventHandle CheckEventHandle;
|
||||||
|
|
||||||
psCliprdrServerCapabilities ServerCapabilities;
|
psCliprdrServerCapabilities ServerCapabilities;
|
||||||
psCliprdrClientCapabilities ClientCapabilities;
|
psCliprdrClientCapabilities ClientCapabilities;
|
||||||
|
Loading…
Reference in New Issue
Block a user