#include <CArch.h>
Inherits IArchConsole, IArchDaemon, IArchFile, IArchLog, IArchMultithread, IArchNetwork, IArchSleep, IArchString, IArchSystem, IArchTaskBar, and IArchTime.
Inheritance diagram for CArch:
Public Member Functions | |
CArch (void *args=NULL) | |
~CArch () | |
virtual void | openConsole (const char *) |
Open the console. | |
virtual void | closeConsole () |
Close the console. | |
virtual void | showConsole (bool showIfEmpty) |
Show the console. | |
virtual void | writeConsole (const char *) |
Write to the console. | |
virtual const char * | getNewlineForConsole () |
Returns the newline sequence for the console. | |
virtual void | installDaemon (const char *name, const char *description, const char *pathname, const char *commandLine, const char *dependencies, bool allUsers) |
Install daemon. | |
virtual void | uninstallDaemon (const char *name, bool allUsers) |
Uninstall daemon. | |
virtual int | daemonize (const char *name, DaemonFunc func) |
virtual bool | canInstallDaemon (const char *name, bool allUsers) |
Check if user has permission to install the daemon. | |
virtual bool | isDaemonInstalled (const char *name, bool allUsers) |
Check if the daemon is installed. | |
virtual const char * | getBasename (const char *pathname) |
Extract base name. | |
virtual std::string | getUserDirectory () |
Get user's home directory. | |
virtual std::string | getSystemDirectory () |
Get system directory. | |
virtual std::string | concatPath (const std::string &prefix, const std::string &suffix) |
Concatenate path components. | |
virtual void | openLog (const char *) |
Open the log. | |
virtual void | closeLog () |
Close the log. | |
virtual void | showLog (bool showIfEmpty) |
Show the log. | |
virtual void | writeLog (ELevel, const char *) |
virtual CArchCond | newCondVar () |
Create a condition variable. | |
virtual void | closeCondVar (CArchCond) |
Destroy a condition variable. | |
virtual void | signalCondVar (CArchCond) |
Signal a condition variable. | |
virtual void | broadcastCondVar (CArchCond) |
Broadcast a condition variable. | |
virtual bool | waitCondVar (CArchCond, CArchMutex, double timeout) |
Wait on a condition variable. | |
virtual CArchMutex | newMutex () |
Create a recursive mutex. | |
virtual void | closeMutex (CArchMutex) |
Destroy a mutex. | |
virtual void | lockMutex (CArchMutex) |
Lock a mutex. | |
virtual void | unlockMutex (CArchMutex) |
Unlock a mutex. | |
virtual CArchThread | newThread (ThreadFunc, void *) |
virtual CArchThread | newCurrentThread () |
Get a reference to the calling thread. | |
virtual CArchThread | copyThread (CArchThread) |
Copy a thread object. | |
virtual void | closeThread (CArchThread) |
Release a thread reference. | |
virtual void | cancelThread (CArchThread) |
Force a thread to exit. | |
virtual void | setPriorityOfThread (CArchThread, int n) |
Change thread priority. | |
virtual void | testCancelThread () |
Cancellation point. | |
virtual bool | wait (CArchThread, double timeout) |
Wait for a thread to exit. | |
virtual bool | isSameThread (CArchThread, CArchThread) |
Compare threads. | |
virtual bool | isExitedThread (CArchThread) |
Test if thread exited. | |
virtual void * | getResultOfThread (CArchThread) |
Returns the exit code of a thread. | |
virtual ThreadID | getIDOfThread (CArchThread) |
Returns an ID for a thread. | |
virtual void | setSignalHandler (ESignal, SignalFunc, void *) |
virtual void | raiseSignal (ESignal) |
virtual CArchSocket | newSocket (EAddressFamily, ESocketType) |
virtual CArchSocket | copySocket (CArchSocket s) |
Copy a socket object. | |
virtual void | closeSocket (CArchSocket s) |
Release a socket reference. | |
virtual void | closeSocketForRead (CArchSocket s) |
Close socket for further reads. | |
virtual void | closeSocketForWrite (CArchSocket s) |
Close socket for further writes. | |
virtual void | bindSocket (CArchSocket s, CArchNetAddress addr) |
Bind socket to address. | |
virtual void | listenOnSocket (CArchSocket s) |
Listen for connections on socket. | |
virtual CArchSocket | acceptSocket (CArchSocket s, CArchNetAddress *addr) |
Accept connection on socket. | |
virtual bool | connectSocket (CArchSocket s, CArchNetAddress name) |
Connect socket. | |
virtual int | pollSocket (CPollEntry[], int num, double timeout) |
virtual void | unblockPollSocket (CArchThread thread) |
Unblock thread in pollSocket(). | |
virtual size_t | readSocket (CArchSocket s, void *buf, size_t len) |
Read data from socket. | |
virtual size_t | writeSocket (CArchSocket s, const void *buf, size_t len) |
Write data from socket. | |
virtual void | throwErrorOnSocket (CArchSocket) |
Check error on socket. | |
virtual bool | setNoDelayOnSocket (CArchSocket, bool noDelay) |
Turn Nagle algorithm on or off on socket. | |
virtual bool | setReuseAddrOnSocket (CArchSocket, bool reuse) |
Turn address reuse on or off on socket. | |
virtual std::string | getHostName () |
Return local host's name. | |
virtual CArchNetAddress | newAnyAddr (EAddressFamily) |
virtual CArchNetAddress | copyAddr (CArchNetAddress) |
Copy a network address. | |
virtual CArchNetAddress | nameToAddr (const std::string &) |
Convert a name to a network address. | |
virtual void | closeAddr (CArchNetAddress) |
Destroy a network address. | |
virtual std::string | addrToName (CArchNetAddress) |
Convert an address to a host name. | |
virtual std::string | addrToString (CArchNetAddress) |
Convert an address to a string. | |
virtual EAddressFamily | getAddrFamily (CArchNetAddress) |
Get an address's family. | |
virtual void | setAddrPort (CArchNetAddress, int port) |
Set the port of an address. | |
virtual int | getAddrPort (CArchNetAddress) |
Get the port of an address. | |
virtual bool | isAnyAddr (CArchNetAddress) |
Test for the "any" address. | |
virtual bool | isEqualAddr (CArchNetAddress, CArchNetAddress) |
Test addresses for equality. | |
virtual void | sleep (double timeout) |
Sleep. | |
virtual int | vsnprintf (char *str, int size, const char *fmt, va_list ap) |
printf() to limited size buffer with va_list | |
virtual int | convStringMBToWC (wchar_t *, const char *, UInt32 n, bool *errors) |
Convert multibyte string to wide character string. | |
virtual int | convStringWCToMB (char *, const wchar_t *, UInt32 n, bool *errors) |
Convert wide character string to multibyte string. | |
virtual EWideCharEncoding | getWideCharEncoding () |
Return the architecture's native wide character encoding. | |
virtual std::string | getOSName () const |
Identify the OS. | |
virtual std::string | getPlatformName () const |
Identify the platform. | |
virtual void | addReceiver (IArchTaskBarReceiver *) |
Add a receiver. | |
virtual void | removeReceiver (IArchTaskBarReceiver *) |
Remove a receiver. | |
virtual void | updateReceiver (IArchTaskBarReceiver *) |
Update a receiver. | |
virtual double | time () |
Get the current time. | |
Static Public Member Functions | |
static CArch * | getInstance () |
Return the singleton instance. |
This class is a centralized interface to all architecture dependent interface implementations (except miscellaneous functions). It instantiates an implementation of each interface and delegates calls to each method to those implementations. Clients should use the ARCH
macro to access this object. Clients must also instantiate exactly one of these objects before attempting to call any method, typically at the beginning of main()
.
Definition at line 48 of file CArch.h.
CArchSocket CArch::acceptSocket | ( | CArchSocket | s, | |
CArchNetAddress * | addr | |||
) | [virtual] |
Accept connection on socket.
Accepts a connection on socket s
, returning a new socket for the connection and filling in addr
with the address of the remote end. addr
may be NULL if the remote address isn't required. The original socket s
is unaffected and remains in the listening state. The new socket shares most of the properties of s
except it's not in the listening state and it's connected. Returns NULL if there are no pending connection requests.
Implements IArchNetwork.
Definition at line 456 of file CArch.cpp.
References IArchNetwork::acceptSocket().
void CArch::addReceiver | ( | IArchTaskBarReceiver * | ) | [virtual] |
Add a receiver.
Add a receiver object to be notified of user and application events. This should be called before other methods. When the receiver is added to the task bar, its icon appears on the task bar.
Implements IArchTaskBar.
Definition at line 624 of file CArch.cpp.
References IArchTaskBar::addReceiver().
void CArch::bindSocket | ( | CArchSocket | s, | |
CArchNetAddress | addr | |||
) | [virtual] |
Bind socket to address.
Binds socket s
to the address addr
.
Implements IArchNetwork.
Definition at line 444 of file CArch.cpp.
References IArchNetwork::bindSocket().
void CArch::broadcastCondVar | ( | CArchCond | ) | [virtual] |
Broadcast a condition variable.
Broadcasting a condition variable releases all waiting threads.
Implements IArchMultithread.
Definition at line 294 of file CArch.cpp.
References IArchMultithread::broadcastCondVar().
void CArch::cancelThread | ( | CArchThread | ) | [virtual] |
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.
Definition at line 354 of file CArch.cpp.
References IArchMultithread::cancelThread().
bool CArch::canInstallDaemon | ( | const char * | name, | |
bool | allUsers | |||
) | [virtual] |
Check if user has permission to install the daemon.
Returns true iff the caller has permission to install or uninstall the daemon. Note that even if this method returns true it's possible that installing/uninstalling the service may still fail. This method ignores whether or not the service is already installed.
Implements IArchDaemon.
Definition at line 216 of file CArch.cpp.
References IArchDaemon::canInstallDaemon().
void CArch::closeConsole | ( | ) | [virtual] |
Close the console.
Close the console. Calling this method on an already closed console must have no effect.
Implements IArchConsole.
Definition at line 168 of file CArch.cpp.
References IArchConsole::closeConsole().
void CArch::closeLog | ( | ) | [virtual] |
Close the log.
Close the log.
Implements IArchLog.
Definition at line 258 of file CArch.cpp.
References IArchLog::closeLog().
void CArch::closeSocket | ( | CArchSocket | s | ) | [virtual] |
Release a socket reference.
Deletes the given socket object. This does not destroy the socket the object referred to until there are no remaining references for the socket.
Implements IArchNetwork.
Definition at line 426 of file CArch.cpp.
References IArchNetwork::closeSocket().
void CArch::closeSocketForRead | ( | CArchSocket | s | ) | [virtual] |
Close socket for further reads.
Calling this disallows future reads on socket s
.
Implements IArchNetwork.
Definition at line 432 of file CArch.cpp.
References IArchNetwork::closeSocketForRead().
void CArch::closeSocketForWrite | ( | CArchSocket | s | ) | [virtual] |
Close socket for further writes.
Calling this disallows future writes on socket s
.
Implements IArchNetwork.
Definition at line 438 of file CArch.cpp.
References IArchNetwork::closeSocketForWrite().
void CArch::closeThread | ( | CArchThread | ) | [virtual] |
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.
Definition at line 348 of file CArch.cpp.
References IArchMultithread::closeThread().
std::string CArch::concatPath | ( | const std::string & | prefix, | |
const std::string & | suffix | |||
) | [virtual] |
Concatenate path components.
Concatenate pathname components with a directory separator between them. This should not check if the resulting path is longer than allowed by the system; we'll rely on the system calls to tell us that.
Implements IArchFile.
Definition at line 246 of file CArch.cpp.
References IArchFile::concatPath().
bool CArch::connectSocket | ( | CArchSocket | s, | |
CArchNetAddress | name | |||
) | [virtual] |
Connect socket.
Connects the socket s
to the remote address addr
. Returns true if the connection succeed immediately, false if the connection is in progress, and throws if the connection failed immediately. If it returns false, pollSocket()
can be used to wait on the socket for writing to detect when the connection finally succeeds or fails.
Implements IArchNetwork.
Definition at line 462 of file CArch.cpp.
References IArchNetwork::connectSocket().
CArchSocket CArch::copySocket | ( | CArchSocket | s | ) | [virtual] |
Copy a socket object.
Returns a reference to to socket referred to by s
.
Implements IArchNetwork.
Definition at line 420 of file CArch.cpp.
References IArchNetwork::copySocket().
CArchThread CArch::copyThread | ( | CArchThread | ) | [virtual] |
Copy a thread object.
Returns a reference to to thread referred to by thread
.
Implements IArchMultithread.
Definition at line 342 of file CArch.cpp.
References IArchMultithread::copyThread().
const char * CArch::getBasename | ( | const char * | pathname | ) | [virtual] |
Extract base name.
Find the base name in the given pathname
.
Implements IArchFile.
Definition at line 228 of file CArch.cpp.
References IArchFile::getBasename().
IArchMultithread::ThreadID CArch::getIDOfThread | ( | CArchThread | ) | [virtual] |
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.
Definition at line 396 of file CArch.cpp.
References IArchMultithread::getIDOfThread().
CArch * CArch::getInstance | ( | ) | [static] |
const char * CArch::getNewlineForConsole | ( | ) | [virtual] |
Returns the newline sequence for the console.
Different consoles use different character sequences for newlines. This method returns the appropriate newline sequence for the console.
Implements IArchConsole.
Definition at line 186 of file CArch.cpp.
References IArchConsole::getNewlineForConsole().
std::string CArch::getOSName | ( | ) | const [virtual] |
Identify the OS.
Returns a string identifying the operating system.
Implements IArchSystem.
Definition at line 612 of file CArch.cpp.
References IArchSystem::getOSName().
std::string CArch::getPlatformName | ( | ) | const [virtual] |
Identify the platform.
Returns a string identifying the platform this OS is running on.
Implements IArchSystem.
Definition at line 618 of file CArch.cpp.
References IArchSystem::getPlatformName().
void * CArch::getResultOfThread | ( | CArchThread | ) | [virtual] |
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.
Definition at line 390 of file CArch.cpp.
References IArchMultithread::getResultOfThread().
std::string CArch::getSystemDirectory | ( | ) | [virtual] |
Get system directory.
Returns the ussystem configuration file directory.
Implements IArchFile.
Definition at line 240 of file CArch.cpp.
References IArchFile::getSystemDirectory().
std::string CArch::getUserDirectory | ( | ) | [virtual] |
Get user's home directory.
Returns the user's home directory. Returns the empty string if this cannot be determined.
Implements IArchFile.
Definition at line 234 of file CArch.cpp.
References IArchFile::getUserDirectory().
void CArch::installDaemon | ( | const char * | name, | |
const char * | description, | |||
const char * | pathname, | |||
const char * | commandLine, | |||
const char * | dependencies, | |||
bool | allUsers | |||
) | [virtual] |
Install daemon.
Install a daemon. name
is the name of the daemon passed to the system and description
is a short human readable description of the daemon. pathname
is the path to the daemon executable. commandLine
should not include the name of program as the first argument. If allUsers
is true then the daemon will be installed to start at boot time, otherwise it will be installed to start when the current user logs in. If dependencies
is not NULL then it's a concatenation of NUL terminated other daemon names followed by a NUL; the daemon will be configured to startup after the listed daemons. Throws an XArchDaemon
exception on failure.
Implements IArchDaemon.
Definition at line 192 of file CArch.cpp.
References IArchDaemon::installDaemon().
bool CArch::isAnyAddr | ( | CArchNetAddress | ) | [virtual] |
Test for the "any" address.
Returns true if addr
is the "any" address. newAnyAddr()
returns an "any" address.
Implements IArchNetwork.
Definition at line 570 of file CArch.cpp.
References IArchNetwork::isAnyAddr().
bool CArch::isDaemonInstalled | ( | const char * | name, | |
bool | allUsers | |||
) | [virtual] |
Check if the daemon is installed.
Returns true iff the daemon is installed.
Implements IArchDaemon.
Definition at line 222 of file CArch.cpp.
References IArchDaemon::isDaemonInstalled().
bool CArch::isExitedThread | ( | CArchThread | ) | [virtual] |
Test if thread exited.
Returns true iff thread
has exited.
Implements IArchMultithread.
Definition at line 384 of file CArch.cpp.
References IArchMultithread::isExitedThread().
bool CArch::isSameThread | ( | CArchThread | , | |
CArchThread | ||||
) | [virtual] |
Compare threads.
Returns true iff two thread objects refer to the same thread. Note that comparing thread objects directly is meaningless.
Implements IArchMultithread.
Definition at line 378 of file CArch.cpp.
References IArchMultithread::isSameThread().
void CArch::listenOnSocket | ( | CArchSocket | s | ) | [virtual] |
Listen for connections on socket.
Causes the socket s
to begin listening for incoming connections.
Implements IArchNetwork.
Definition at line 450 of file CArch.cpp.
References IArchNetwork::listenOnSocket().
CArchCond CArch::newCondVar | ( | ) | [virtual] |
Create a condition variable.
The condition variable is an opaque data type.
Implements IArchMultithread.
Definition at line 276 of file CArch.cpp.
References IArchMultithread::newCondVar().
CArchThread CArch::newCurrentThread | ( | ) | [virtual] |
Get a reference to the calling thread.
Returns a thread representing the current (i.e. calling) thread.
Implements IArchMultithread.
Definition at line 336 of file CArch.cpp.
References IArchMultithread::newCurrentThread().
CArchMutex CArch::newMutex | ( | ) | [virtual] |
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.
Definition at line 306 of file CArch.cpp.
References IArchMultithread::newMutex().
void CArch::openConsole | ( | const char * | ) | [virtual] |
Open the console.
Opens the console for writing. The console is opened automatically on the first write so calling this method is optional. Uses title
for the console's title if appropriate for the architecture. Calling this method on an already open console must have no effect.
Implements IArchConsole.
Definition at line 162 of file CArch.cpp.
References IArchConsole::openConsole().
void CArch::openLog | ( | const char * | ) | [virtual] |
Open the log.
Opens the log for writing. The log must be opened before being written to.
Implements IArchLog.
Definition at line 252 of file CArch.cpp.
References IArchLog::openLog().
size_t CArch::readSocket | ( | CArchSocket | s, | |
void * | buf, | |||
size_t | len | |||
) | [virtual] |
Read data from socket.
Read up to len
bytes from socket s
in buf
and return the number of bytes read. The number of bytes can be less than len
if not enough data is available. Returns 0 if the remote end has disconnected and/or there is no more queued received data.
Implements IArchNetwork.
Definition at line 480 of file CArch.cpp.
References IArchNetwork::readSocket().
void CArch::removeReceiver | ( | IArchTaskBarReceiver * | ) | [virtual] |
Remove a receiver.
Remove a receiver object from the task bar. This removes the icon from the task bar.
Implements IArchTaskBar.
Definition at line 630 of file CArch.cpp.
References IArchTaskBar::removeReceiver().
bool CArch::setNoDelayOnSocket | ( | CArchSocket | , | |
bool | noDelay | |||
) | [virtual] |
Turn Nagle algorithm on or off on socket.
Set socket to send messages immediately (true) or to collect small messages into one packet (false). Returns the previous state.
Implements IArchNetwork.
Definition at line 498 of file CArch.cpp.
References IArchNetwork::setNoDelayOnSocket().
void CArch::setPriorityOfThread | ( | CArchThread | , | |
int | n | |||
) | [virtual] |
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.
Definition at line 360 of file CArch.cpp.
References IArchMultithread::setPriorityOfThread().
bool CArch::setReuseAddrOnSocket | ( | CArchSocket | , | |
bool | reuse | |||
) | [virtual] |
Turn address reuse on or off on socket.
Allows the address this socket is bound to to be reused while in the TIME_WAIT state. Returns the previous state.
Implements IArchNetwork.
Definition at line 504 of file CArch.cpp.
References IArchNetwork::setReuseAddrOnSocket().
void CArch::showConsole | ( | bool | showIfEmpty | ) | [virtual] |
Show the console.
Causes the console to become visible. This generally only makes sense for a console in a graphical user interface. Other implementations will do nothing. Iff showIfEmpty
is false
then the implementation may optionally only show the console if it's not empty.
Implements IArchConsole.
Definition at line 174 of file CArch.cpp.
References IArchConsole::showConsole().
void CArch::showLog | ( | bool | showIfEmpty | ) | [virtual] |
Show the log.
Causes the log to become visible. This generally only makes sense for a log in a graphical user interface. Other implementations will do nothing. Iff showIfEmpty
is false
then the implementation may optionally only show the log if it's not empty.
Implements IArchLog.
Definition at line 264 of file CArch.cpp.
References IArchLog::showLog().
void CArch::signalCondVar | ( | CArchCond | ) | [virtual] |
Signal a condition variable.
Signalling a condition variable releases one waiting thread.
Implements IArchMultithread.
Definition at line 288 of file CArch.cpp.
References IArchMultithread::signalCondVar().
void CArch::sleep | ( | double | timeout | ) | [virtual] |
Sleep.
Blocks the calling thread for timeout
seconds. If timeout
< 0.0 then the call returns immediately. If timeout
== 0.0 then the calling thread yields the CPU.
(cancellation point)
Implements IArchSleep.
Definition at line 582 of file CArch.cpp.
References IArchSleep::sleep().
void CArch::testCancelThread | ( | ) | [virtual] |
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.
Definition at line 366 of file CArch.cpp.
References IArchMultithread::testCancelThread().
void CArch::throwErrorOnSocket | ( | CArchSocket | ) | [virtual] |
Check error on socket.
If the socket s
is in an error state then throws an appropriate XArchNetwork exception.
Implements IArchNetwork.
Definition at line 492 of file CArch.cpp.
References IArchNetwork::throwErrorOnSocket().
double CArch::time | ( | ) | [virtual] |
Get the current time.
Returns the number of seconds since some arbitrary starting time. This should return as high a precision as reasonable.
Implements IArchTime.
Definition at line 642 of file CArch.cpp.
References IArchTime::time().
void CArch::unblockPollSocket | ( | CArchThread | thread | ) | [virtual] |
Unblock thread in pollSocket().
Cause a thread that's in a pollSocket() call to return. This call may return before the thread is unblocked. If the thread is not in a pollSocket() call this call has no effect.
Implements IArchNetwork.
Definition at line 474 of file CArch.cpp.
References IArchNetwork::unblockPollSocket().
void CArch::uninstallDaemon | ( | const char * | name, | |
bool | allUsers | |||
) | [virtual] |
Uninstall daemon.
Uninstall a daemon. Throws an XArchDaemon
on failure.
Implements IArchDaemon.
Definition at line 204 of file CArch.cpp.
References IArchDaemon::uninstallDaemon().
void CArch::updateReceiver | ( | IArchTaskBarReceiver * | ) | [virtual] |
Update a receiver.
Updates the display of the receiver on the task bar. This should be called when the receiver appearance may have changed (e.g. it's icon or tool tip has changed).
Implements IArchTaskBar.
Definition at line 636 of file CArch.cpp.
References IArchTaskBar::updateReceiver().
int CArch::vsnprintf | ( | char * | str, | |
int | size, | |||
const char * | fmt, | |||
va_list | ap | |||
) | [virtual] |
printf() to limited size buffer with va_list
This method is equivalent to vsprintf() except it will not write more than n
bytes to the buffer, returning -1 if the output was truncated and the number of bytes written not including the trailing NUL otherwise.
Implements IArchString.
Definition at line 588 of file CArch.cpp.
References IArchString::vsnprintf().
bool CArch::wait | ( | CArchThread | , | |
double | timeout | |||
) | [virtual] |
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.
Definition at line 372 of file CArch.cpp.
References IArchMultithread::wait().
bool CArch::waitCondVar | ( | CArchCond | , | |
CArchMutex | , | |||
double | timeout | |||
) | [virtual] |
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.
Definition at line 300 of file CArch.cpp.
References IArchMultithread::waitCondVar().
void CArch::writeConsole | ( | const char * | ) | [virtual] |
Write to the console.
Writes the given string to the console, opening it if necessary.
Implements IArchConsole.
Definition at line 180 of file CArch.cpp.
References IArchConsole::writeConsole().
size_t CArch::writeSocket | ( | CArchSocket | s, | |
const void * | buf, | |||
size_t | len | |||
) | [virtual] |
Write data from socket.
Write up to len
bytes to socket s
from buf
and return the number of bytes written. The number of bytes can be less than len
if the remote end disconnected or the internal buffers fill up.
Implements IArchNetwork.
Definition at line 486 of file CArch.cpp.
References IArchNetwork::writeSocket().