ost::Thread(3)

๐Ÿ“ฆ version 1.8.1, in ubuntu jammy

๐ŸŒธ ost::Thread โ€” NAME ๐ŸŒธ

okay so bestie, this is the ost::Thread(3) manual (library functions manual energy, periodt). Every thread of execution in an application is created by instantiating an object of a class derived from the Thread class. that's the whole plot. ๐Ÿ’…


โœจ SYNOPSIS โœจ

#include <thread.h>

Inherited by ost::PosixThread, ost::SerialService, ost::SocketService, ost::TCPSession, ost::ThreadQueue, ost::TTYSession, and ost::UnixSession. lowkey a whole friend group. ๐Ÿซถ

๐Ÿ”ฎ Public Types

  • enum Throw โ€” how to raise error, fr:
    • throwNothing
    • throwObject
    • throwException
  • enum Cancel โ€” how work cancellation, the way that:
    • cancelInitial =0
    • cancelDeferred =1
    • cancelImmediate
    • cancelDisabled
    • cancelManual
    • cancelDefault =cancelDeferred
  • enum Suspend โ€” how work suspend:
    • suspendEnable
    • suspendDisable
  • typedef enum ost::Thread::Throw Throw โ€” how to raise error.
  • typedef enum ost::Thread::Cancel Cancel โ€” how work cancellation.
  • typedef enum ost::Thread::Suspend Suspend โ€” how work suspend.

๐Ÿ‘‘ Public Member Functions

  • Thread (bool isMain) โ€” ngl this is actually a special constructor used to create a thread 'object' for the current execution context when that context was not created via an instance of a derived Thread object itself.
  • Thread (int pri=0, size_t stack=0) โ€” when a thread object is contructed, a new thread of execution context is created. (yes, 'contructed' as the original says it, iykyk.)
  • Thread (const Thread &th) โ€” a thread of execution can also be specified by cloning an existing thread. copy paste but make it a whole new life. ๐Ÿฆ‹
  • virtual ~Thread () โ€” the thread destructor should clear up any resources that have been allocated by the thread. clean up your room bestie.
  • int start (Semaphore *start=0) โ€” when a new thread is created, it does not begin immediate execution. it's giving waiting for the cue.
  • int detach (Semaphore *start=0) โ€” start a new thread as 'detached'.
  • Thread * getParent (void) โ€” gets the pointer to the Thread class which created the current thread object. find your mother.
  • void suspend (void) โ€” suspends execution of the selected thread.
  • void resume (void) โ€” resumes execution of the selected thread.
  • Cancel getCancel (void) โ€” used to retrieve the cancellation mode in effect for the selected thread.
  • bool isRunning (void) const โ€” verifies if the thread is still running or has already been terminated but not yet deleted.
  • bool isDetached (void) const โ€” check if this thread is detached.
  • void join (void) โ€” blocking call which unlocks when thread terminates.
  • bool isThread (void) const โ€” tests to see if the current execution context is the same as the specified thread object.
  • cctid_t getId (void) const โ€” get system thread numeric identifier.
  • const char * getName (void) const โ€” get the name string for this thread, to use in debug messages.

โญ Static Public Member Functions

  • static Thread * get (void) โ€” no description in the original, bestie. it's mysterious. ๐Ÿ’€
  • static void setStack (size_t size=0) โ€” set base stack limit before manual stack sizes have effect.
  • static void sleep (timeout_t msec) โ€” a thread-safe sleep call. nap time but make it safe. ๐Ÿ˜ด
  • static void yield (void) โ€” yields the current thread's CPU time slice to allow another thread to begin immediate execution. sharing is caring.
  • static Throw getException (void) โ€” get exception mode of the current thread.
  • static void setException (Throw mode) โ€” set exception mode of the current thread.
  • static Cancel enterCancel (void) โ€” this is used to help build wrapper functions in libraries around system calls that should behave as cancellation points but don't.
  • static void exitCancel (Cancel cancel) โ€” this is used to restore a cancel block.

๐Ÿงš Protected Member Functions

  • void setName (const char *text) โ€” set the name of the current thread.
  • virtual void run (void)=0 โ€” all threads execute by deriving the Run method of Thread. pure virtual, so you must do it. no skipping.
  • virtual void final (void) โ€” a thread that is self terminating, either by invoking exit() or leaving it's run(), will have this method called.
  • virtual void initial (void) โ€” the initial method is called by a newly created thread when it starts execution.
  • virtual void * getExtended (void) โ€” since getParent() and getThread() only refer to an object of the Thread 'base' type, this virtual method can be replaced in a derived class with something that returns data specific to the derived class that can still be accessed through the pointer returned by getParent() and getThread().
  • virtual void notify (Thread *) โ€” when a thread terminates, it now sends a notification message to the parent thread which created it.
  • void exit (void) โ€” used to properly exit from a Thread derived run() or initial() method.
  • void sync (void) โ€” used to wait for a join or cancel, in place of explicit exit.
  • bool testCancel (void) โ€” test a cancellation point for deferred thread cancellation.
  • void setCancel (Cancel mode) โ€” sets thread cancellation mode.
  • void setSuspend (Suspend mode) โ€” sets the thread's ability to be suspended from execution.
  • void terminate (void) โ€” used by another thread to terminate the current thread. not me being the main character who ends it. ๐Ÿ’…
  • void clrParent (void) โ€” clear parent thread relationship.

๐Ÿ’– Friends

  • class PosixThread
  • class DummyThread
  • class Cancellation
  • class postream_type
  • class Slog
  • class ThreadImpl
  • void operator++ (Thread &th) โ€” signal the semaphore that the specified thread is waiting for before beginning execution.
  • void operator-- (Thread &th) โ€” no description in the original, so it stays iconic and mysterious. ๐Ÿ™ˆ

โœจ Detailed Description โœจ

Okay bestie, gather round ๐Ÿ’– Every single thread of execution in an application? It gets created by instantiating an object of a class that's derived from the Thread class. No cap.

Classes derived from Thread must implement the run() method โ€” that's literally the code of the thread. The base Thread class supports encapsulation of the generic threading methods implemented on various target operating systems. This includes the ability to start and stop threads in a synchronized and controllable manner, the ability to specify thread execution priority, and thread specific 'system call' wrappers, such as for sleep and yield. A thread exception is thrown if the thread cannot be created. Threading was the first part of Common C++ I wrote, back when it was still the APE library. My goal for Common C++ threading has been to make threading as natural and easy to use in C++ application development as threading is in Java. With this said, one does not need to use threading at all to take advantage of Common C++. However, all Common C++ classes are designed at least to be thread-aware/thread-safe as appropriate and necessary. Periodt. ๐Ÿ’…

Common C++ threading is currently built either from the Posix pthread library or using the win32 SDK. In that the Posix pthread draft has gone through many revisions, and many system implementations are only marginally compliant, and even then usually in different ways, I wrote a large series of autoconf macros found in ost_pthread.m4 which handle the task of identifying which pthread features and capabilities your target platform supports. In the process I learned much about what autoconf can and cannot do for you.. ngl, autoconf said "vibe check" and I felt that. ๐Ÿ˜ญ

Currently the GNU Portable Thread library (GNU pth) is not directly supported in Common C++. While GNU Pth doesn't offer direct native threading support or benefit from SMP hardware, many of the design advantages of threading can be gained from it's use, and the Pth pthread emulation library should be usable with Common C++. In the future, Common C++ will directly support Pth, as well as OS/2 and BeOS native threading API's. manifesting that future upgrade โœจ

Common C++ itself defines a fairly 'neutral' threading model that is not tied to any specific API such as pthread, win32, etc. This neutral thread model is contained in a series of classes which handle threading and synchronization and which may be used together to build reliable threaded applications. it's giving "platform agnostic icon" ๐Ÿ‘‘

Common C++ defines application specific threads as objects which are derived from the Common C++ Thread base class. At minimum the Run method must be implemented, and this method essentially is the 'thread', for it is executed within the execution context of the thread, and when the Run method terminates the thread is assumed to have terminated. the way that Run carries the whole plotโ€ฆ ๐ŸŽ€

Common C++ allows one to specify the running priority of a newly created thread relative to the 'parent' thread which is the thread that is executing when the constructor is called. Since most newer C++ implementations do not allow one to call virtual constructors or virtual methods from constructors, the thread must be 'started' after the constructor returns. This is done either by defining a 'starting' semaphore object that one or more newly created thread objects can wait upon, or by invoking an explicit 'start' member function. no cap, constructors can't do everything ๐Ÿ’€

Threads can be 'suspended' and 'resumed'. As this behavior is not defined in the Posix pthread specification, it is often emulated through signals. Typically SIGUSR1 will be used for this purpose in Common C++ applications, depending in the target platform. On Linux, since threads are indeed processes, SIGSTP and SIGCONT can be used. On solaris, the Solaris thread library supports suspend and resume directly. Linux said "I'm a process, actually" ๐Ÿ˜ญ

Threads can be canceled. Not all platforms support the concept of externally cancelable threads. On those platforms and API implementations that do not, threads are typically canceled through the action of a signal handler. some platforms are just not that girl when it comes to cancellation ๐Ÿ’…

As noted earlier, threads are considered running until the Run method returns, or until a cancellation request is made. Common C++ threads can control how they respond to cancellation, using setCancellation(). Cancellation requests can be ignored, set to occur only when a cancellation 'point' has been reached in the code, or occur immediately. Threads can also exit by returning from Run() or by invoking the Exit() method. choose your own adventure, but make it threads ๐Ÿฆ‹

Generally it is a good practice to initialize any resources the thread may require within the constructor of your derived thread class, and to purge or restore any allocated resources in the destructor. In most cases, the destructor will be executed after the thread has terminated, and hence will execute within the context of the thread that requested a join rather than in the context of the thread that is being terminated. Most destructors in derived thread classes should first call Terminate() to make sure the thread has stopped running before releasing resources. bestie, clean up after yourself, it's the bare minimum ๐Ÿงš

A Common C++ thread is normally canceled by deleting the thread object. The process of deletion invokes the thread's destructor, and the destructor will then perform a 'join' against the thread using the Terminate() function. This behavior is not always desirable since the thread may block itself from cancellation and block the current 'delete' operation from completing. One can alternately invoke Terminate() directly before deleting a thread object. warning: delete can get stuck in the group chat if the thread is being dramatic ๐Ÿšจ

When a given Common C++ thread exits on it's own through it's Run() method, a 'Final' method will be called. This Final method will be called while the thread is 'detached'. If a thread object is constructed through a 'new' operator, it's final method can be used to 'self delete' when done, and allows an independent thread to construct and remove itself autonomously. independent thread with main character energy, we love to see it ๐Ÿ‘‘

A special global function, getThread(), is provided to identify the thread object that represents the current execution context you are running under. This is sometimes needed to deliver signals to the correct thread. Since all thread manipulation should be done through the Common C++ (base) thread class itself, this provides the same functionality as things like pthread_self for Common C++. it's giving "who am I? find out with getThread()" ๐Ÿชž

All Common C++ threads have an exception 'mode' which determines their behavior when an exception is thrown by another Common C++ class. Extensions to Common C++ should respect the current exception mode and use getException() to determine what to do when they are about to throw an object. The default exception mode (defined in the Thread() constructor) is throwObject, which causes a pointer to an instance of the class where the error occured to be thrown. Other exception modes are throwException, which causes a class-specific exception class to be thrown, and throwNothing, which causes errors to be ignored. pick your fighter: throwObject, throwException, or throwNothing ๐Ÿ’…

As an example, you could try to call the Socket class with an invalid address that the system could not bind to. This would cause an object of type Socket * to be thrown by default, as the default exception mode is throwObject. If you call setException(throwException) before the bad call to the Socket constructor, an object of type SockException (the exception class for class Socket) will be thrown instead. scenario: you broke the Socket, now you get a whole exception class about it ๐Ÿ˜ญ

To determine what exception class is thrown by a given Common C++ class when the exception mode is set to throwException, search the source files for the class you are interested in for a class which inherits directly or indirectly from class Exception. This is the exception class which would be thrown when the exception mode is set to throwException. detective work but make it C++ ๐Ÿ”

The advantage of using throwException versus throwObject is that more information is available to the programmer from the thrown object. All class-specific exceptions inherit from class Exception, which provides a getString() method which can be called to get a human-readable error string. more info = better vibes when debugging ๐Ÿ’–

Common C++ threads are often aggregated into other classes to provide services that are 'managed' from or operate within the context of a thread, even within the Common C++ framework itself. A good example of this is the TCPSession class, which essentially is a combination of a TCP client connection and a separate thread the user can define by deriving a class with a Run() method to handle the connected service. This aggregation logically connects the successful allocation of a given resource with the construction of a thread to manage and perform operations for said resource. it's giving "resource + thread = otp" ๐Ÿ’ž

Threads are also used in 'service pools'. In Common C++, a service pool is one or more threads that are used to manage a set of resources. While Common C++ does not provide a direct 'pool' class, it does provide a model for their implementation, usually by constructing an array of thread 'service' objects, each of which can then be assigned the next new instance of a given resource in turn or algorithmically. pool party but for threads ๐ŸŠ

Threads have signal handlers associated with them. Several signal types are 'predefined' and have special meaning. All signal handlers are defined as virtual member functions of the Thread class which are called when a specific signal is received for a given thread. The SIGPIPE event is defined as a 'Disconnect' event since it's normally associated with a socket disconnecting or broken fifo. The Hangup() method is associated with the SIGHUP signal. All other signals are handled through the more generic Signal(). signals are the DMs of the Unix world ๐Ÿ“ฉ

Incidently, unlike Posix, the win32 API has no concept of signals, and certainly no means to define or deliver signals on a per-thread basis. For this reason, no signal handling is supported or emulated in the win32 implementation of Common C++ at this time. win32 said "no signal era" ๐Ÿ’€

In addition to TCPStream, there is a TCPSession class which combines a thread with a TCPStream object. The assumption made by TCPSession is that one will service each TCP connection with a separate thread, and this makes sense for systems where extended connections may be maintained and complex protocols are being used over TCP. one connection, one thread, that's the rule ๐Ÿงต


โœจ Author โœจ

David Sugar dyfet@ostel.com

base class used to derive all threads of execution.


โœจ Examples โœจ

  • bug1.cpp
  • bug2.cpp
  • tcpservice.cpp
  • tcpstr1.cpp
  • thread1.cpp
  • thread2.cpp

โœจ Member Typedef Documentation โœจ

typedef enum ost::Thread::Cancel ost::Thread::Cancel

How work cancellation. the cancel button, but make it a typedef ๐Ÿ›‘

typedef enum ost::Thread::Suspend ost::Thread::Suspend

How work suspend. pause button energy โธ๏ธ

typedef enum ost::Thread::Throw ost::Thread::Throw

How to raise error. the throw exception vibe ๐Ÿšจ


โœจ Member Enumeration Documentation โœจ

Okay bestie, gather round, because this is where ost::Thread spills the tea on its enums โ˜•๐Ÿ’–


enum ost::Thread::Cancel

How work cancellation. ๐Ÿ›‘

Enumerator

  • cancelInitial โ€” used internally, do not use ๐Ÿ™ˆ
  • cancelDeferred โ€” exit the thread on a cancellation point such as yield โœจ
  • cancelImmediate โ€” exit before cancellation ๐Ÿšช
  • cancelDisabled โ€” ignore cancellation ๐Ÿšซ
  • cancelManual โ€” unimplemented (working in progress) ๐Ÿšง
  • cancelDefault โ€” default, you should use this for compatibility instead of deferred ๐Ÿ’…

enum ost::Thread::Suspend

How work suspend. โธ๏ธ

Enumerator

  • suspendEnable โ€” suspend enabled โœ…
  • suspendDisable โ€” suspend disabled, Suspend do nothing ๐Ÿ’€

enum ost::Thread::Throw

How to raise error. ๐Ÿ’ฅ

Enumerator

  • throwNothing โ€” continue without throwing error ๐Ÿšซ
  • throwObject โ€” throw object that cause error (throw this) ๐ŸŽฏ
  • throwException โ€” throw an object relative to error ๐ŸŒ€

๐ŸŽ€ Constructor & Destructor Documentation ๐ŸŽ€

ost::Thread::Thread (bool isMain)

This is actually a special constructor that is used to create a thread 'object' for the current execution context when that context is not created via an instance of a derived Thread object itself. This constructor does not support First. ๐Ÿ‘‘

Parameters

  • isMain โ€” bool used if the main 'thread' of the application.

ost::Thread::Thread (int pri = 0, size_t stack = 0)

When a thread object is constructed, a new thread of execution context is created. This constructor allows basic properties of that context (thread priority, stack space, etc) to be defined. The starting condition is also specified for whether the thread is to wait on a semaphore before beginning execution or wait until its start method is called. โœจ

Parameters

  • pri โ€” thread base priority relative to it's parent.
  • stack โ€” space as needed in some implementations.

ost::Thread::Thread (const Thread & th)

A thread of execution can also be specified by cloning an existing thread. The existing thread's properties (cancel mode, priority, etc), are also duplicated. ๐Ÿงฌ

Parameters

  • th โ€” currently executing thread object to clone.

virtual ost::Thread::~Thread () [virtual]

The thread destructor should clear up any resources that have been allocated by the thread. The destructor of a derived thread should begin with Terminate() and is presumed to then execute within the context of the thread causing termination. ๐Ÿ’€


โœจ Member Function Documentation โœจ

okay bestie, this is the BIG one โ€” every single method, all the details, no skipping ๐Ÿ’…


void ost::Thread::clrParent (void) [inline], [protected]

clears the parent thread relationship. that's it, that's the whole thing, it's giving boundary setting ๐ŸŽ€

int ost::Thread::detach (Semaphore * start = 0)

starts a new thread as 'detached'. this is an alternative start() method, and it exists to resolve some issues with later glibc implementations that incorrectly implement self-detach. so basically the workaround era of threading, iconic honestly โœจ

Returns: error code if execution fails.

Parameters: start โ€” optional starting semaphore to alternately use.

Examples: thread2.cpp.

static Cancel ost::Thread::enterCancel (void) [static]

this one is used to help build wrapper functions in libraries around system calls that should behave as cancellation points but don't. rude of them honestly ๐Ÿ˜ญ

Returns: saved cancel type.

void ost::Thread::exit (void) [protected]

used to properly exit from a Thread derived run() or initial() method. it terminates execution of the current thread and calls the derived class's final() method. so like, the polite way to leave the function ๐Ÿซถ

static void ost::Thread::exitCancel (Cancel cancel) [static]

used to restore a cancel block. the cancel era is over, we're putting it back.

Parameters: cancel โ€” type that was saved.

virtual void ost::Thread::final (void) [protected], [virtual]

a thread that is self-terminating โ€” either by invoking exit() or by leaving its run() โ€” will have this method called. it can be used to self-delete the current object, assuming the object was created with new on the heap rather than stack local. hence, bestie, one may often see final defined as 'delete this' in a derived thread class. a final method, while running, cannot be terminated or cancelled by another thread. Final is called for all cancellation types (even immediate).

you can safely delete the thread class ('delete this') on final, but you should exit ASAP โ€” or do not try to call CommonC++ methods...

โš ๏ธ Note: a thread cannot delete its own context or join itself. to make a thread that is a self-running object that self-deletes, one has to detach the thread by using detach() instead of start(). no cap, this one matters.

See also: exit, run

Reimplemented in ost::ThreadQueue.

static Thread* ost::Thread::get (void) [static]

referenced by ost::getThread(). short king of a method, does its job ๐ŸŒธ

Cancel ost::Thread::getCancel (void) [inline]

used to retrieve the cancellation mode in effect for the selected thread.

Returns: cancellation mode constant.

static Throw ost::Thread::getException (void) [static]

gets the exception mode of the current thread.

Returns: exception mode.

virtual void* ost::Thread::getExtended (void) [protected], [virtual]

since getParent() and getThread() only refer to an object of the Thread 'base' type, this virtual method can be replaced in a derived class with something that returns data specific to the derived class โ€” and that data can still be accessed through the pointer returned by getParent() and getThread(). it's giving polymorphism moment ๐Ÿ’œ

Returns: pointer to derived class specific data.

cctid_t ost::Thread::getId (void) const

gets the system thread numeric identifier.

Returns: numeric identifier of this thread.

const char* ost::Thread::getName (void) const [inline]

gets the name string for this thread, to use in debug messages.

Returns: debug name.

Thread* ost::Thread::getParent (void) [inline]

gets the pointer to the Thread class which created the current thread object.

Returns: a Thread *, or '(Thread *)this' if no parent. orphan thread energy ๐Ÿฆ‹

virtual void ost::Thread::initial (void) [protected], [virtual]

the initial method is called by a newly created thread when it starts execution. this method is run with deferred cancellation disabled by default. the Initial method is given a separate handler so that it can create temporary objects on its own stack frame, rather than having objects created on run() that are only needed by startup and yet continue to consume stack space. efficiency queen โœจ

See also: run, final

Reimplemented in ost::UnixSession, and ost::TCPSession.

bool ost::Thread::isDetached (void) const

checks if this thread is detached.

Returns: true if the thread is detached.

bool ost::Thread::isRunning (void) const

verifies if the thread is still running, or has already been terminated but not yet deleted.

Returns: true if the thread is still executing.

bool ost::Thread::isThread (void) const

tests to see if the current execution context is the same as the specified thread object.

Returns: true if the current context is this object.

void ost::Thread::join (void)

a blocking call which unlocks when the thread terminates. we wait ๐Ÿ’…

virtual void ost::Thread::notify (Thread *) [protected], [virtual]

when a thread terminates, it now sends a notification message to the parent thread which created it. the actual use of this notification is left to be defined in a derived class. your call, bestie ๐ŸŽ€

Parameters: โ€” the thread that has terminated.

void ost::Thread::resume (void)

resumes execution of the selected thread. wake up babe ๐ŸŒˆ

virtual void ost::Thread::run (void) [protected], [pure virtual]

all threads execute by deriving the Run method of Thread. this method is called after Initial to begin normal operation of the thread. if the method terminates, then the thread will also terminate after notifying its parent and calling its Final() method.

See also: #Initial

void ost::Thread::setCancel (Cancel mode) [protected]

sets thread cancellation mode. threads can either be set immune to termination (cancelDisabled), can be set to terminate when reaching specific 'thread cancellation points' (cancelDeferred), or immediately when Terminate is requested (cancelImmediate).

Parameters: mode for cancellation of the current thread.

static void ost::Thread::setException (Throw mode) [static]

sets the exception mode of the current thread.

Returns: exception mode.

void ost::Thread::setName (const char * text) [protected]

sets the name of the current thread. if the name is passed as NULL, then the default name is set (usually object pointer).

Parameters: text โ€” name to use.

static void ost::Thread::setStack (size_t size = 0) [inline], [static]

sets the base stack limit before manual stack sizes have effect.

Parameters: size โ€” stack size to set, or use 0 to clear autostack.

void ost::Thread::setSuspend (Suspend mode) [protected]

sets the thread's ability to be suspended from execution. the thread may either have suspend enabled (suspendEnable) or disabled (suspendDisable).

Parameters: mode for suspend.

static void ost::Thread::sleep (timeout_t msec) [static]

a thread-safe sleep call. on most Posix systems, 'sleep()' is implemented with SIGALRM, making it unusable from multiple threads ๐Ÿ˜ญ. Pthread libraries often define an alternate 'sleep' handler such as usleep(), nanosleep(), or nap(), that is thread safe, and also offers a higher timer resolution. slay for precision ๐ŸŽฏ

Parameters: msec โ€” timeout in milliseconds.

Examples: thread1.cpp.

int ost::Thread::start (Semaphore * start = 0)

when a new thread is created, it does not begin immediate execution. this is because the derived class virtual tables are not properly loaded at the time the C++ object is created within the constructor itself โ€” at least in some compiler/system combinations. the thread can either be told to wait for an external semaphore, or it can be started directly after the constructor completes by calling the start() method. constructor timing drama, we've all been there ๐Ÿ™ˆ

Returns: error code if execution fails.

Parameters: start โ€” optional starting semaphore to alternately use.

void ost::Thread::suspend (void)

suspends execution of the selected thread. Pthreads do not normally support suspendable threads, so the behavior is simulated with signals. on systems such as Linux that define threads as processes, SIGSTOP and SIGCONT may be used. signal witchcraft, but make it โœจfunctionalโœจ

void ost::Thread::sync (void) [protected]

used to wait for a join or cancel, in place of explicit exit.

void ost::Thread::terminate (void) [protected]

used by another thread to terminate the current thread. termination actually occurs based on the current setCancel() mode. when the current thread does terminate, control is returned to the requesting thread. terminate() should always be called at the start of any destructor of a class derived from Thread to assure the remaining part of the destructor is called without the thread still executing.

๐Ÿ”ฅ this is the "always call it first in your destructor" rule and it is not optional, bestie. periodt.

bool ost::Thread::testCancel (void) [protected]

tests a cancellation point for deferred thread cancellation.

static void ost::Thread::yield (void) [static]

yields the current thread's CPU time slice to allow another thread to begin immediate execution. sharing is caring ๐Ÿ’–


the inner circle. the group chat members. the ones with access ๐Ÿ’…

  • friend class Cancellation [friend]
  • friend class DummyThread [friend]
  • void operator++ (Thread & th) [friend] โ€” signals the semaphore that the specified thread is waiting for before beginning execution.

Parameters: th โ€” specified thread.

  • void operator-- (Thread & th) [friend]
  • friend class PosixThread [friend]
  • friend class postream_type [friend]
  • friend class Slog [friend]
  • friend class ThreadImpl [friend]

๐ŸŒธ Author ๐ŸŒธ

generated automatically by Doxygen for GNU CommonC++ from the source code.


and that's the whole page, bestie, you read ALL of it ๐Ÿ‘‘ this beauty came out of GNU CommonC++, dated Sun Dec 27 2020, and it lives at ost::Thread(3). go forth and thread responsibly, mwah ๐Ÿ’œ๐ŸŽ€โœจ

๐Ÿ“ฆ where this page comes from