[return checks] fix use of WaitForSingleObject
This commit is contained in:
parent
965d231e49
commit
bb242b9a89
@ -27,6 +27,7 @@
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
#include "camera.h"
|
||||
#include <winpr/handle.h>
|
||||
|
||||
#define TAG CHANNELS_TAG("rdpecam-v4l.client")
|
||||
|
||||
@ -530,7 +531,7 @@ UINT cam_v4l_stream_stop(CamV4lStream* stream)
|
||||
|
||||
if (stream->captureThread)
|
||||
{
|
||||
WaitForSingleObject(stream->captureThread, INFINITE);
|
||||
(void)WaitForSingleObject(stream->captureThread, INFINITE);
|
||||
(void)CloseHandle(stream->captureThread);
|
||||
stream->captureThread = NULL;
|
||||
}
|
||||
|
@ -1446,7 +1446,7 @@ static void terminate_plugin_cb(GENERIC_DYNVC_PLUGIN* base)
|
||||
|
||||
if (rdpei->thread)
|
||||
{
|
||||
WaitForSingleObject(rdpei->thread, INFINITE);
|
||||
(void)WaitForSingleObject(rdpei->thread, INFINITE);
|
||||
(void)CloseHandle(rdpei->thread);
|
||||
}
|
||||
|
||||
|
@ -1461,7 +1461,7 @@ void rdpsnd_virtual_channel_event_terminated(rdpsndPlugin* rdpsnd)
|
||||
|
||||
if (rdpsnd->thread)
|
||||
{
|
||||
WaitForSingleObject(rdpsnd->thread, INFINITE);
|
||||
(void)WaitForSingleObject(rdpsnd->thread, INFINITE);
|
||||
(void)CloseHandle(rdpsnd->thread);
|
||||
}
|
||||
MessageQueue_Free(rdpsnd->queue);
|
||||
|
@ -180,7 +180,7 @@ static void rdpsnd_winmm_close(rdpsndDevicePlugin* device)
|
||||
|
||||
if (winmm->hThread)
|
||||
{
|
||||
WaitForSingleObject(winmm->hThread, INFINITE);
|
||||
(void)WaitForSingleObject(winmm->hThread, INFINITE);
|
||||
(void)CloseHandle(winmm->hThread);
|
||||
winmm->hThread = NULL;
|
||||
}
|
||||
|
@ -826,7 +826,7 @@ static void irp_thread_close(void* arg)
|
||||
else
|
||||
{
|
||||
(void)TerminateThread(hdl, 0);
|
||||
WaitForSingleObject(hdl, INFINITE);
|
||||
(void)WaitForSingleObject(hdl, INFINITE);
|
||||
(void)CloseHandle(hdl);
|
||||
}
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ static IUDEVICE* udevman_get_udevice_by_ChannelID(IUDEVMAN* idevman, UINT32 chan
|
||||
static void udevman_loading_lock(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN* udevman = (UDEVMAN*)idevman;
|
||||
WaitForSingleObject(udevman->devman_loading, INFINITE);
|
||||
(void)WaitForSingleObject(udevman->devman_loading, INFINITE);
|
||||
}
|
||||
|
||||
static void udevman_loading_unlock(IUDEVMAN* idevman)
|
||||
@ -469,7 +469,7 @@ static void udevman_free(IUDEVMAN* idevman)
|
||||
udevman->running = FALSE;
|
||||
if (udevman->thread)
|
||||
{
|
||||
WaitForSingleObject(udevman->thread, INFINITE);
|
||||
(void)WaitForSingleObject(udevman->thread, INFINITE);
|
||||
(void)CloseHandle(udevman->thread);
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1466,7 @@ static int wfreerdp_client_stop(rdpContext* context)
|
||||
if (wfc->keyboardThread)
|
||||
{
|
||||
PostThreadMessage(wfc->keyboardThreadId, WM_QUIT, 0, 0);
|
||||
WaitForSingleObject(wfc->keyboardThread, INFINITE);
|
||||
(void)WaitForSingleObject(wfc->keyboardThread, INFINITE);
|
||||
(void)CloseHandle(wfc->keyboardThread);
|
||||
wfc->keyboardThread = NULL;
|
||||
wfc->keyboardThreadId = 0;
|
||||
|
@ -2535,7 +2535,7 @@ BOOL wf_cliprdr_uninit(wfContext* wfc, CliprdrClientContext* cliprdr)
|
||||
|
||||
if (clipboard->thread)
|
||||
{
|
||||
WaitForSingleObject(clipboard->thread, INFINITE);
|
||||
(void)WaitForSingleObject(clipboard->thread, INFINITE);
|
||||
(void)CloseHandle(clipboard->thread);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
thread = freerdp_client_get_thread(context);
|
||||
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
(void)WaitForSingleObject(thread, INFINITE);
|
||||
GetExitCodeThread(thread, &dwExitCode);
|
||||
rc = xf_exit_code_from_disconnect_reason(dwExitCode);
|
||||
|
||||
|
@ -805,7 +805,7 @@ void xf_lock_x11_(xfContext* xfc, const char* fkt)
|
||||
{
|
||||
|
||||
if (!xfc->UseXThreads)
|
||||
WaitForSingleObject(xfc->mutex, INFINITE);
|
||||
(void)WaitForSingleObject(xfc->mutex, INFINITE);
|
||||
else
|
||||
XLockDisplay(xfc->display);
|
||||
|
||||
@ -1451,7 +1451,7 @@ static void xf_post_disconnect(freerdp* instance)
|
||||
|
||||
if (xfc->pipethread)
|
||||
{
|
||||
WaitForSingleObject(xfc->pipethread, INFINITE);
|
||||
(void)WaitForSingleObject(xfc->pipethread, INFINITE);
|
||||
(void)CloseHandle(xfc->pipethread);
|
||||
xfc->pipethread = NULL;
|
||||
}
|
||||
|
@ -1339,7 +1339,7 @@ int freerdp_client_common_stop(rdpContext* context)
|
||||
|
||||
if (cctx->thread)
|
||||
{
|
||||
WaitForSingleObject(cctx->thread, INFINITE);
|
||||
(void)WaitForSingleObject(cctx->thread, INFINITE);
|
||||
(void)CloseHandle(cctx->thread);
|
||||
cctx->thread = NULL;
|
||||
}
|
||||
|
@ -2078,7 +2078,7 @@ void cliprdr_file_context_free(CliprdrFileContext* file)
|
||||
cliprdr_file_session_terminate(file, TRUE);
|
||||
|
||||
WLog_Print(file->log, WLOG_DEBUG, "Waiting on FUSE thread");
|
||||
WaitForSingleObject(file->fuse_thread, INFINITE);
|
||||
(void)WaitForSingleObject(file->fuse_thread, INFINITE);
|
||||
(void)CloseHandle(file->fuse_thread);
|
||||
}
|
||||
if (file->fuse_stop_sync)
|
||||
|
@ -2844,7 +2844,7 @@ static int tsg_read(rdpTsg* tsg, BYTE* data, size_t length)
|
||||
if (!tsg_check_event_handles(tsg))
|
||||
return -1;
|
||||
|
||||
WaitForSingleObject(rpc->client->PipeEvent, 100);
|
||||
(void)WaitForSingleObject(rpc->client->PipeEvent, 100);
|
||||
}
|
||||
}
|
||||
} while (transport_get_blocking(rpc->transport));
|
||||
|
@ -2905,7 +2905,7 @@ void update_message_proxy_free(rdpUpdateProxy* message)
|
||||
{
|
||||
rdp_update_internal* up = update_cast(message->update);
|
||||
if (MessageQueue_PostQuit(up->queue, 0))
|
||||
WaitForSingleObject(message->thread, INFINITE);
|
||||
(void)WaitForSingleObject(message->thread, INFINITE);
|
||||
|
||||
(void)CloseHandle(message->thread);
|
||||
free(message);
|
||||
|
@ -148,7 +148,7 @@ static int testAbort(int port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
WaitForSingleObject(s_sync, INFINITE);
|
||||
(void)WaitForSingleObject(s_sync, INFINITE);
|
||||
Sleep(100); /* Wait until freerdp_connect has been called */
|
||||
if (instance)
|
||||
{
|
||||
@ -293,7 +293,7 @@ static int testSuccess(int port)
|
||||
if (!TerminateProcess(process.hProcess, 0))
|
||||
goto fail;
|
||||
|
||||
WaitForSingleObject(process.hProcess, INFINITE);
|
||||
(void)WaitForSingleObject(process.hProcess, INFINITE);
|
||||
(void)CloseHandle(process.hProcess);
|
||||
(void)CloseHandle(process.hThread);
|
||||
printf("%s: returned %d!\n", __func__, r);
|
||||
|
@ -83,7 +83,7 @@ static void test_peer_context_free(freerdp_peer* client, rdpContext* ctx)
|
||||
{
|
||||
WINPR_ASSERT(context->stopEvent);
|
||||
(void)SetEvent(context->stopEvent);
|
||||
WaitForSingleObject(context->debug_channel_thread, INFINITE);
|
||||
(void)WaitForSingleObject(context->debug_channel_thread, INFINITE);
|
||||
(void)CloseHandle(context->debug_channel_thread);
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
WLog_INFO(TAG, "Starting server");
|
||||
wfreerdp_server_start(server);
|
||||
WaitForSingleObject(server->thread, INFINITE);
|
||||
(void)WaitForSingleObject(server->thread, INFINITE);
|
||||
WLog_INFO(TAG, "Stopping server");
|
||||
wfreerdp_server_stop(server);
|
||||
wfreerdp_server_free(server);
|
||||
|
@ -218,7 +218,7 @@ static DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam)
|
||||
}
|
||||
|
||||
(void)SetEvent(context->socketEvent);
|
||||
WaitForSingleObject(context->socketSemaphore, INFINITE);
|
||||
(void)WaitForSingleObject(context->socketSemaphore, INFINITE);
|
||||
|
||||
if (context->socketClose)
|
||||
break;
|
||||
|
@ -80,7 +80,7 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
|
||||
{
|
||||
// WLog_DBG(TAG, "Waiting for %d of %d", index + 1, wfi->activePeerCount);
|
||||
// WaitForSingleObject(wfi->updateSemaphore, INFINITE);
|
||||
WaitForSingleObject(wfi->updateSemaphore, 1000);
|
||||
(void)WaitForSingleObject(wfi->updateSemaphore, 1000);
|
||||
}
|
||||
|
||||
// WLog_DBG(TAG, "End of parallel sending");
|
||||
|
@ -719,7 +719,7 @@ out_free_peer:
|
||||
if (pdata && pdata->client_thread)
|
||||
{
|
||||
proxy_data_abort_connect(pdata);
|
||||
WaitForSingleObject(pdata->client_thread, INFINITE);
|
||||
(void)WaitForSingleObject(pdata->client_thread, INFINITE);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ static BOOL shw_end_paint(rdpContext* context)
|
||||
}
|
||||
|
||||
(void)SetEvent(subsystem->RdpUpdateEnterEvent);
|
||||
WaitForSingleObject(subsystem->RdpUpdateLeaveEvent, INFINITE);
|
||||
(void)WaitForSingleObject(subsystem->RdpUpdateLeaveEvent, INFINITE);
|
||||
(void)ResetEvent(subsystem->RdpUpdateLeaveEvent);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1460,7 +1460,7 @@ static int x11_shadow_subsystem_stop(rdpShadowSubsystem* sub)
|
||||
if (subsystem->thread)
|
||||
{
|
||||
if (MessageQueue_PostQuit(subsystem->common.MsgPipe->In, 0))
|
||||
WaitForSingleObject(subsystem->thread, INFINITE);
|
||||
(void)WaitForSingleObject(subsystem->thread, INFINITE);
|
||||
|
||||
(void)CloseHandle(subsystem->thread);
|
||||
subsystem->thread = NULL;
|
||||
|
@ -172,7 +172,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
WaitForSingleObject(server->thread, INFINITE);
|
||||
(void)WaitForSingleObject(server->thread, INFINITE);
|
||||
|
||||
if (!GetExitCodeThread(server->thread, &dwExitCode))
|
||||
status = -1;
|
||||
|
@ -140,7 +140,7 @@ static void WaitForSubscribers(rdpShadowMultiClientEvent* event)
|
||||
/* Wait for clients done */
|
||||
WLog_VRB(TAG, "Server wait event %d. %d clients.\n", event->eventid, event->consuming);
|
||||
LeaveCriticalSection(&(event->lock));
|
||||
WaitForSingleObject(event->doneEvent, INFINITE);
|
||||
(void)WaitForSingleObject(event->doneEvent, INFINITE);
|
||||
EnterCriticalSection(&(event->lock));
|
||||
WLog_VRB(TAG, "Server quit event %d. %d clients.\n", event->eventid, event->consuming);
|
||||
}
|
||||
@ -219,7 +219,7 @@ static BOOL Consume(struct rdp_shadow_multiclient_subscriber* subscriber, BOOL w
|
||||
*/
|
||||
event->waiting++;
|
||||
LeaveCriticalSection(&(event->lock));
|
||||
WaitForSingleObject(event->barrierEvent, INFINITE);
|
||||
(void)WaitForSingleObject(event->barrierEvent, INFINITE);
|
||||
EnterCriticalSection(&(event->lock));
|
||||
event->waiting--;
|
||||
if (event->waiting == 0)
|
||||
|
@ -743,7 +743,7 @@ int shadow_server_stop(rdpShadowServer* server)
|
||||
if (server->thread)
|
||||
{
|
||||
(void)SetEvent(server->StopEvent);
|
||||
WaitForSingleObject(server->thread, INFINITE);
|
||||
(void)WaitForSingleObject(server->thread, INFINITE);
|
||||
(void)CloseHandle(server->thread);
|
||||
server->thread = NULL;
|
||||
if (server->listener && server->listener->Close)
|
||||
|
@ -113,10 +113,10 @@ int TestErrorSetLastError(int argc, char* argv[])
|
||||
Sleep(200);
|
||||
bStopTest = TRUE;
|
||||
|
||||
WaitForSingleObject(threads[0], INFINITE);
|
||||
WaitForSingleObject(threads[1], INFINITE);
|
||||
WaitForSingleObject(threads[2], INFINITE);
|
||||
WaitForSingleObject(threads[3], INFINITE);
|
||||
(void)WaitForSingleObject(threads[0], INFINITE);
|
||||
(void)WaitForSingleObject(threads[1], INFINITE);
|
||||
(void)WaitForSingleObject(threads[2], INFINITE);
|
||||
(void)WaitForSingleObject(threads[3], INFINITE);
|
||||
|
||||
(void)CloseHandle(threads[0]);
|
||||
(void)CloseHandle(threads[1]);
|
||||
|
@ -33,7 +33,7 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg)
|
||||
DWORD nNumberOfBytesToWrite = 0;
|
||||
DWORD lpNumberOfBytesRead = 0;
|
||||
DWORD lpNumberOfBytesWritten = 0;
|
||||
WaitForSingleObject(ReadyEvent, INFINITE);
|
||||
(void)WaitForSingleObject(ReadyEvent, INFINITE);
|
||||
hNamedPipe =
|
||||
CreateFile(lpszPipeNameMt, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
||||
@ -198,7 +198,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
|
||||
int numPipes = 0;
|
||||
BOOL bSuccess = FALSE;
|
||||
numPipes = TESTNUMPIPESST;
|
||||
WaitForSingleObject(ReadyEvent, INFINITE);
|
||||
(void)WaitForSingleObject(ReadyEvent, INFINITE);
|
||||
|
||||
for (int i = 0; i < numPipes; i++)
|
||||
{
|
||||
@ -500,9 +500,9 @@ int TestPipeCreateNamedPipe(int argc, char* argv[])
|
||||
printf("CreateThread (ServerThread) failure: (%" PRIu32 ")\n", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
WaitForSingleObject(SingleThread, INFINITE);
|
||||
WaitForSingleObject(ClientThread, INFINITE);
|
||||
WaitForSingleObject(ServerThread, INFINITE);
|
||||
(void)WaitForSingleObject(SingleThread, INFINITE);
|
||||
(void)WaitForSingleObject(ClientThread, INFINITE);
|
||||
(void)WaitForSingleObject(ServerThread, INFINITE);
|
||||
(void)CloseHandle(SingleThread);
|
||||
(void)CloseHandle(ClientThread);
|
||||
(void)CloseHandle(ServerThread);
|
||||
|
@ -100,7 +100,7 @@ static DWORD WINAPI thread_pool_work_func(LPVOID arg)
|
||||
|
||||
static void threads_close(void* thread)
|
||||
{
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
(void)WaitForSingleObject(thread, INFINITE);
|
||||
(void)CloseHandle(thread);
|
||||
}
|
||||
|
||||
|
@ -848,7 +848,7 @@ int TestSchannel(int argc, char* argv[])
|
||||
|
||||
schannel_send(table, g_ServerWritePipe, &context, test_LastDummyMessage,
|
||||
sizeof(test_LastDummyMessage));
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
(void)WaitForSingleObject(thread, INFINITE);
|
||||
sspi_GlobalFinish();
|
||||
return 0;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ BOOL WINAPI winpr_EnterSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBarrie
|
||||
}
|
||||
|
||||
if (block)
|
||||
WaitForSingleObject(hCurrentEvent, INFINITE);
|
||||
(void)WaitForSingleObject(hCurrentEvent, INFINITE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ int TestSynchAPC(int argc, char* argv[])
|
||||
thread = CreateThread(NULL, 0, uncleanThread, &userApcArg, 0, NULL);
|
||||
if (!thread)
|
||||
return 10;
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
(void)WaitForSingleObject(thread, INFINITE);
|
||||
(void)CloseHandle(thread);
|
||||
|
||||
if (userApcArg.called || userApcArg.error)
|
||||
@ -141,7 +141,7 @@ int TestSynchAPC(int argc, char* argv[])
|
||||
if (!QueueUserAPC((PAPCFUNC)userApc, thread, (ULONG_PTR)&userApcArg))
|
||||
return 21;
|
||||
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
(void)WaitForSingleObject(thread, INFINITE);
|
||||
(void)CloseHandle(thread);
|
||||
|
||||
if (!userApcArg.called)
|
||||
@ -162,7 +162,7 @@ int TestSynchAPC(int argc, char* argv[])
|
||||
if (!thread)
|
||||
return 33;
|
||||
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
(void)WaitForSingleObject(thread, INFINITE);
|
||||
(void)CloseHandle(thread);
|
||||
|
||||
if (uncleanCloseData.timer1Calls != 1 || uncleanCloseData.timer2Calls != 0)
|
||||
|
@ -75,7 +75,7 @@ static void _winpr_openssl_locking(int mode, int type, const char* file, int lin
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
{
|
||||
WaitForSingleObject(g_winpr_openssl_locks[type], INFINITE);
|
||||
(void)WaitForSingleObject(g_winpr_openssl_locks[type], INFINITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,7 +104,7 @@ static void _winpr_openssl_dynlock_lock(int mode, struct CRYPTO_dynlock_value* d
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
{
|
||||
WaitForSingleObject(dynlock->mutex, INFINITE);
|
||||
(void)WaitForSingleObject(dynlock->mutex, INFINITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -88,8 +88,8 @@ int TestMessagePipe(int argc, char* argv[])
|
||||
goto out;
|
||||
}
|
||||
|
||||
WaitForSingleObject(ClientThread, INFINITE);
|
||||
WaitForSingleObject(ServerThread, INFINITE);
|
||||
(void)WaitForSingleObject(ClientThread, INFINITE);
|
||||
(void)WaitForSingleObject(ServerThread, INFINITE);
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user