Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
ArchMultithreadWindows Class Reference

Win32 implementation of IArchMultithread. More...

#include <ArchMultithreadWindows.h>

Inheritance diagram for ArchMultithreadWindows:
Collaboration diagram for ArchMultithreadWindows:

Public Member Functions

 ArchMultithreadWindows ()
 ~ArchMultithreadWindows () override
manipulators
void setNetworkDataForCurrentThread (void *)
Public Member Functions inherited from IArchMultithread
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

accessors

HANDLE getCancelEventForCurrentThread ()
void * getNetworkDataForThread (ArchThread)
ArchCond newCondVar () override
 Create a condition variable.
void closeCondVar (ArchCond) override
 Destroy a condition variable.
void signalCondVar (ArchCond) override
 Signal a condition variable.
void broadcastCondVar (ArchCond) override
 Broadcast a condition variable.
bool waitCondVar (ArchCond, ArchMutex, double timeout) override
 Wait on a condition variable.
ArchMutex newMutex () override
 Create a recursive mutex.
void closeMutex (ArchMutex) override
 Destroy a mutex.
void lockMutex (ArchMutex) override
 Lock a mutex.
void unlockMutex (ArchMutex) override
 Unlock a mutex.
ArchThread newThread (ThreadFunc, void *) override
 Start a new thread.
ArchThread newCurrentThread () override
 Get a reference to the calling thread.
ArchThread copyThread (ArchThread) override
 Copy a thread object.
void closeThread (ArchThread) override
 Release a thread reference.
void cancelThread (ArchThread) override
 Force a thread to exit.
void setPriorityOfThread (ArchThread, int n) override
 Change thread priority.
void testCancelThread () override
 Cancellation point.
bool wait (ArchThread, double timeout) override
 Wait for a thread to exit.
bool isSameThread (ArchThread, ArchThread) override
 Compare threads.
bool isExitedThread (ArchThread) override
 Test if thread exited.
void * getResultOfThread (ArchThread) override
 Returns the exit code of a thread.
ThreadID getIDOfThread (ArchThread) override
 Returns an ID for a thread.
void setSignalHandler (ThreadSignal, SignalFunc, void *) override
 Set the interrupt handler.
void raiseSignal (ThreadSignal) override
 Invoke the signal handler.
static ArchMultithreadWindowsgetInstance ()

Additional Inherited Members

Public Types inherited from IArchMultithread
enum class  ThreadSignal : uint8_t {
  Interrupt , Terminate , Hangup , User ,
  MaxSignals
}
 Types of signals. More...
using ThreadFunc = void *(*)(void *)
 Type of thread entry point.
using ThreadID = unsigned int
 Type of thread identifier.
using SignalFunc = void (*)(ThreadSignal, void *userData)
 Type of signal handler function.

Detailed Description

Win32 implementation of IArchMultithread.

Constructor & Destructor Documentation

◆ ArchMultithreadWindows()

ArchMultithreadWindows::ArchMultithreadWindows ( )

◆ ~ArchMultithreadWindows()

ArchMultithreadWindows::~ArchMultithreadWindows ( )
override

Member Function Documentation

◆ broadcastCondVar()

void ArchMultithreadWindows::broadcastCondVar ( ArchCond )
overridevirtual

Broadcast a condition variable.

Broadcasting a condition variable releases all waiting threads.

Implements IArchMultithread.

◆ cancelThread()

void ArchMultithreadWindows::cancelThread ( ArchThread thread)
overridevirtual

Force a thread to exit.

Causes thread to exit when it next calls a cancellation point. A thread avoids cancellation as long as it nevers calls a cancellation point. Once it begins the cancellation process it must always let cancellation go to completion but may take as long as necessary to clean up.

Implements IArchMultithread.

◆ closeCondVar()

void ArchMultithreadWindows::closeCondVar ( ArchCond )
overridevirtual

Destroy a condition variable.

Implements IArchMultithread.

◆ closeMutex()

void ArchMultithreadWindows::closeMutex ( ArchMutex )
overridevirtual

Destroy a mutex.

Implements IArchMultithread.

◆ closeThread()

void ArchMultithreadWindows::closeThread ( ArchThread )
overridevirtual

Release a thread reference.

Deletes the given thread object. This does not destroy the thread the object referred to, even if there are no remaining references. Use cancelThread() and waitThread() to stop a thread and wait for it to exit.

Implements IArchMultithread.

◆ copyThread()

ArchThread ArchMultithreadWindows::copyThread ( ArchThread thread)
overridevirtual

Copy a thread object.

Returns a reference to to thread referred to by thread.

Implements IArchMultithread.

◆ getCancelEventForCurrentThread()

HANDLE ArchMultithreadWindows::getCancelEventForCurrentThread ( )

◆ getIDOfThread()

IArchMultithread::ThreadID ArchMultithreadWindows::getIDOfThread ( ArchThread thread)
overridevirtual

Returns an ID for a thread.

Returns some ID number for thread. This is for logging purposes. All thread objects referring to the same thread return the same ID. However, clients should us isSameThread() to compare thread objects instead of comparing IDs.

Implements IArchMultithread.

◆ getInstance()

ArchMultithreadWindows * ArchMultithreadWindows::getInstance ( )
static

◆ getNetworkDataForThread()

void * ArchMultithreadWindows::getNetworkDataForThread ( ArchThread thread)

◆ getResultOfThread()

void * ArchMultithreadWindows::getResultOfThread ( ArchThread thread)
overridevirtual

Returns the exit code of a thread.

Waits indefinitely for thread to exit (if it hasn't yet) then returns the thread's exit code.

(Cancellation point)

Implements IArchMultithread.

◆ isExitedThread()

bool ArchMultithreadWindows::isExitedThread ( ArchThread thread)
overridevirtual

Test if thread exited.

Returns true iff thread has exited.

Implements IArchMultithread.

◆ isSameThread()

bool ArchMultithreadWindows::isSameThread ( ArchThread ,
ArchThread  )
overridevirtual

Compare threads.

Returns true iff two thread objects refer to the same thread. Note that comparing thread objects directly is meaningless.

Implements IArchMultithread.

◆ lockMutex()

void ArchMultithreadWindows::lockMutex ( ArchMutex )
overridevirtual

Lock a mutex.

Implements IArchMultithread.

◆ newCondVar()

ArchCond ArchMultithreadWindows::newCondVar ( )
overridevirtual

Create a condition variable.

The condition variable is an opaque data type.

Implements IArchMultithread.

◆ newCurrentThread()

ArchThread ArchMultithreadWindows::newCurrentThread ( )
overridevirtual

Get a reference to the calling thread.

Returns a thread representing the current (i.e. calling) thread.

Implements IArchMultithread.

◆ newMutex()

ArchMutex ArchMultithreadWindows::newMutex ( )
overridevirtual

Create a recursive mutex.

Creates a recursive mutex. A thread may lock a recursive mutex when it already holds a lock on that mutex. The mutex is an opaque data type.

Implements IArchMultithread.

◆ newThread()

ArchThread ArchMultithreadWindows::newThread ( ThreadFunc func,
void * userData )
overridevirtual

Start a new thread.

Creates and starts a new thread, using func as the entry point and passing it userData. The thread is an opaque data type.

Implements IArchMultithread.

◆ raiseSignal()

void ArchMultithreadWindows::raiseSignal ( ThreadSignal signal)
overridevirtual

Invoke the signal handler.

Invokes the signal handler for signal, if any. If no handler cancels the main thread for ThreadSignal::Interrupt and ThreadSignal::Terminate and ignores the call otherwise.

Implements IArchMultithread.

◆ setNetworkDataForCurrentThread()

void ArchMultithreadWindows::setNetworkDataForCurrentThread ( void * data)

◆ setPriorityOfThread()

void ArchMultithreadWindows::setPriorityOfThread ( ArchThread ,
int n )
overridevirtual

Change thread priority.

Changes the priority of thread by n. If n is positive the thread has a lower priority and if negative a higher priority. Some architectures may not support either or both directions.

Implements IArchMultithread.

◆ setSignalHandler()

void ArchMultithreadWindows::setSignalHandler ( ThreadSignal ,
SignalFunc func,
void * userData )
overridevirtual

Set the interrupt handler.

Sets the function to call on receipt of an external interrupt. By default and when func is nullptr, the main thread is cancelled.

Implements IArchMultithread.

◆ signalCondVar()

void ArchMultithreadWindows::signalCondVar ( ArchCond )
overridevirtual

Signal a condition variable.

Signalling a condition variable releases one waiting thread.

Implements IArchMultithread.

◆ testCancelThread()

void ArchMultithreadWindows::testCancelThread ( )
overridevirtual

Cancellation point.

This method does nothing but is a cancellation point. Clients can make their own functions cancellation points by calling this method at appropriate times.

(Cancellation point)

Implements IArchMultithread.

◆ unlockMutex()

void ArchMultithreadWindows::unlockMutex ( ArchMutex )
overridevirtual

Unlock a mutex.

Implements IArchMultithread.

◆ wait()

bool ArchMultithreadWindows::wait ( ArchThread thread,
double timeout )
overridevirtual

Wait for a thread to exit.

Waits for up to timeout seconds for thread to exit (normally or by cancellation). Waits forever if timeout < 0. Returns true if the thread exited, false otherwise. Waiting on the current thread returns immediately with false.

(Cancellation point)

Implements IArchMultithread.

◆ waitCondVar()

bool ArchMultithreadWindows::waitCondVar ( ArchCond ,
ArchMutex ,
double timeout )
overridevirtual

Wait on a condition variable.

Wait on a conditation variable for up to timeout seconds. If timeout is < 0 then there is no timeout. The mutex must be locked when this method is called. The mutex is unlocked during the wait and locked again before returning. Returns true if the condition variable was signalled and false on timeout.

(Cancellation point)

Implements IArchMultithread.


The documentation for this class was generated from the following files: