Deskflow 1.22.0.197
Keyboard and mouse sharing utility
|
Posix implementation of IArchMultithread. More...
#include <ArchMultithreadPosix.h>
Public Member Functions | |
ArchMultithreadPosix () | |
ArchMultithreadPosix (ArchMultithreadPosix const &)=delete | |
ArchMultithreadPosix (ArchMultithreadPosix &&)=delete | |
~ArchMultithreadPosix () override | |
ArchMultithreadPosix & | operator= (ArchMultithreadPosix const &)=delete |
ArchMultithreadPosix & | operator= (ArchMultithreadPosix &&)=delete |
manipulators | |
void | setNetworkDataForCurrentThread (void *) |
Public Member Functions inherited from IArchMultithread | |
Public Member Functions inherited from IInterface | |
virtual | ~IInterface ()=default |
Interface destructor does nothing. |
accessors | |
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 *) final |
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) final |
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 ArchMultithreadPosix * | getInstance () |
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. |
Posix implementation of IArchMultithread.
ArchMultithreadPosix::ArchMultithreadPosix | ( | ) |
|
delete |
|
delete |
|
override |
|
overridevirtual |
Broadcast a condition variable.
Broadcasting a condition variable releases all waiting threads.
Implements IArchMultithread.
|
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.
|
overridevirtual |
Destroy a condition variable.
Implements IArchMultithread.
|
overridevirtual |
Destroy a mutex.
Implements IArchMultithread.
|
finalvirtual |
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.
|
overridevirtual |
Copy a thread object.
Returns a reference to to thread referred to by thread
.
Implements IArchMultithread.
|
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.
|
static |
void * ArchMultithreadPosix::getNetworkDataForThread | ( | 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.
|
overridevirtual |
|
overridevirtual |
Compare threads.
Returns true iff two thread objects refer to the same thread. Note that comparing thread objects directly is meaningless.
Implements IArchMultithread.
|
overridevirtual |
Lock a mutex.
Implements IArchMultithread.
|
overridevirtual |
Create a condition variable.
The condition variable is an opaque data type.
Implements IArchMultithread.
|
overridevirtual |
Get a reference to the calling thread.
Returns a thread representing the current (i.e. calling) thread.
Implements IArchMultithread.
|
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.
|
finalvirtual |
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.
|
delete |
|
delete |
|
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.
void ArchMultithreadPosix::setNetworkDataForCurrentThread | ( | void * | data | ) |
|
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.
|
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.
|
overridevirtual |
Signal a condition variable.
Signalling a condition variable releases one waiting thread.
Implements IArchMultithread.
|
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.
|
overridevirtual |
Unlock a mutex.
Implements IArchMultithread.
|
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.
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.