FreeRDP
thread.c File Reference
#include <assert.h>
#include <winpr/handle.h>
#include <winpr/thread.h>
#include <winpr/crt.h>
#include <winpr/platform.h>
#include <winpr/debug.h>
#include <errno.h>
#include <fcntl.h>
#include <winpr/collections.h>
#include "thread.h"
#include "../handle/handle.h"
#include "../log.h"

Macros

#define TAG   WINPR_TAG("thread")
 

Functions

static BOOL ThreadCloseHandle (HANDLE handle)
 
static void cleanup_handle (void *obj)
 
static BOOL ThreadIsHandled (HANDLE handle)
 
static int ThreadGetFd (HANDLE handle)
 
static DWORD ThreadCleanupHandle (HANDLE handle)
 
static void dump_thread (WINPR_THREAD *thread)
 
static BOOL set_event (WINPR_THREAD *thread)
 
static BOOL reset_event (WINPR_THREAD *thread)
 
static BOOL thread_compare (const void *a, const void *b)
 
static voidthread_launcher (void *arg)
 
static BOOL winpr_StartThread (WINPR_THREAD *thread)
 
HANDLE CreateThread (LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId)
 
HANDLE CreateRemoteThread (HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId)
 
VOID ExitThread (DWORD dwExitCode)
 
BOOL GetExitCodeThread (HANDLE hThread, LPDWORD lpExitCode)
 
HANDLE _GetCurrentThread (VOID)
 
DWORD GetCurrentThreadId (VOID)
 
DWORD ResumeThread (HANDLE hThread)
 
DWORD SuspendThread (HANDLE hThread)
 
BOOL SwitchToThread (VOID)
 
BOOL TerminateThread (HANDLE hThread, DWORD dwExitCode)
 

Variables

static wListDictionary * thread_list = NULL
 
static HANDLE_OPS ops
 

Macro Definition Documentation

#define TAG   WINPR_TAG("thread")

WinPR: Windows Portable Runtime Process Thread Functions

Copyright 2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2015 Hewlett-Packard Development Company, L.P.

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. api-ms-win-core-processthreads-l1-1-1.dll

CreateRemoteThread CreateRemoteThreadEx CreateThread DeleteProcThreadAttributeList ExitThread FlushInstructionCache FlushProcessWriteBuffers GetCurrentThread GetCurrentThreadId GetCurrentThreadStackLimits GetExitCodeThread GetPriorityClass GetStartupInfoW GetThreadContext GetThreadId GetThreadIdealProcessorEx GetThreadPriority GetThreadPriorityBoost GetThreadTimes InitializeProcThreadAttributeList OpenThread OpenThreadToken QueryProcessAffinityUpdateMode QueueUserAPC ResumeThread SetPriorityClass SetThreadContext SetThreadPriority SetThreadPriorityBoost SetThreadStackGuarantee SetThreadToken SuspendThread SwitchToThread TerminateThread UpdateProcThreadAttribute

Function Documentation

HANDLE _GetCurrentThread ( VOID  )

Here is the call graph for this function:

void cleanup_handle ( void obj)
static

Here is the call graph for this function:

Here is the caller graph for this function:

HANDLE CreateRemoteThread ( HANDLE  hProcess,
LPSECURITY_ATTRIBUTES  lpThreadAttributes,
SIZE_T  dwStackSize,
LPTHREAD_START_ROUTINE  lpStartAddress,
LPVOID  lpParameter,
DWORD  dwCreationFlags,
LPDWORD  lpThreadId 
)

Here is the call graph for this function:

HANDLE CreateThread ( LPSECURITY_ATTRIBUTES  lpThreadAttributes,
SIZE_T  dwStackSize,
LPTHREAD_START_ROUTINE  lpStartAddress,
LPVOID  lpParameter,
DWORD  dwCreationFlags,
LPDWORD  lpThreadId 
)

Here is the call graph for this function:

static void dump_thread ( WINPR_THREAD *  thread)
static

Here is the call graph for this function:

Here is the caller graph for this function:

VOID ExitThread ( DWORD  dwExitCode)

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD GetCurrentThreadId ( VOID  )
BOOL GetExitCodeThread ( HANDLE  hThread,
LPDWORD  lpExitCode 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL reset_event ( WINPR_THREAD *  thread)
static

Here is the caller graph for this function:

DWORD ResumeThread ( HANDLE  hThread)

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL set_event ( WINPR_THREAD *  thread)
static

TODO: implement thread suspend/resume using pthreads http://stackoverflow.com/questions/3140867/suspend-pthreads-without-using-condition

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD SuspendThread ( HANDLE  hThread)

Here is the call graph for this function:

BOOL SwitchToThread ( VOID  )

Note: on some operating systems sched_yield is a stub returning -1. usleep should at least trigger a context switch if any thread is waiting.

BOOL TerminateThread ( HANDLE  hThread,
DWORD  dwExitCode 
)

Here is the call graph for this function:

static BOOL thread_compare ( const void a,
const void b 
)
static

Here is the caller graph for this function:

static void* thread_launcher ( void arg)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static DWORD ThreadCleanupHandle ( HANDLE  handle)
static

Here is the call graph for this function:

BOOL ThreadCloseHandle ( HANDLE  handle)
static

Here is the call graph for this function:

static int ThreadGetFd ( HANDLE  handle)
static

Here is the call graph for this function:

static BOOL ThreadIsHandled ( HANDLE  handle)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL winpr_StartThread ( WINPR_THREAD *  thread)
static

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

HANDLE_OPS ops
static
Initial value:
=
{
NULL
}
static BOOL ThreadCloseHandle(HANDLE handle)
Definition: thread.c:549
static BOOL ThreadIsHandled(HANDLE handle)
Definition: thread.c:102
if availableBytes return NULL
Definition: TPCircularBuffer.h:104
static int ThreadGetFd(HANDLE handle)
Definition: thread.c:115
static DWORD ThreadCleanupHandle(HANDLE handle)
Definition: thread.c:125
wListDictionary* thread_list = NULL
static