Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
thread Namespace Reference

Namespaces

namespace  internal
 

Classes

class  AlwaysSelectable
 
struct  Case
 A Case represents a selectable case in a Select statement. More...
 
class  Channel
 A Channel is a bounded FIFO queue that allows multiple readers and writers to communicate with each other. More...
 
class  CondVar
 
class  Fiber
 
class  Mutex
 
class  MutexLock
 
class  NonSelectable
 
class  PermanentEvent
 
class  Reader
 A Reader is used to read items from a Channel. More...
 
class  Scheduler
 
struct  SchedulerParkGuard
 
class  SchedulerPolicy
 
class  Writer
 A Writer is used to write items to a Channel. More...
 

Typedefs

using CaseArray = absl::InlinedVector< Case, 4 >
 

Functions

bool CanParkAwait () noexcept
 
void SleepFor (absl::Duration duration)
 
void FiberEntry ()
 
bool Cancelled ()
 
Case OnCancel ()
 
int SelectUntil (absl::Time deadline, const CaseArray &cases)
 Returns the index of the first case that is ready, or -1 if the deadline has expired without any case becoming ready.
 
int Select (const CaseArray &cases)
 Returns the index of the first case that is ready, blocking until one is.
 
Case NonSelectableCase ()
 
Case AlwaysSelectableCase ()
 
void SetSchedulerParkGuard (SchedulerParkGuard guard)
 
absl::Status SetCurrentSchedulerPolicy (std::shared_ptr< SchedulerPolicy > policy)
 
void Post (absl::AnyInvocable< void() && > work)
 
void PostAt (absl::Time deadline, absl::AnyInvocable< void() && > work)
 
void PostAfter (absl::Duration delay, absl::AnyInvocable< void() && > work)
 
internal::CaseStateArray MakeShuffledCaseStateArray (size_t num_cases)
 
static void InitRand32 ()
 
uint32_t Rand32 ()
 

Variables

constexpr bool kCanParkAwait = true
 
static std::atomic< uint32_t > last_rand32
 
static absl::once_flag init_rand32_once
 

Typedef Documentation

◆ CaseArray

typedef absl::InlinedVector< Case, 4 > thread::CaseArray

Function Documentation

◆ AlwaysSelectableCase()

Case thread::AlwaysSelectableCase ( )

◆ Cancelled()

bool thread::Cancelled ( )

◆ CanParkAwait()

bool thread::CanParkAwait ( )
inlinenoexcept

◆ FiberEntry()

void thread::FiberEntry ( )

◆ InitRand32()

static void thread::InitRand32 ( )
static

◆ MakeShuffledCaseStateArray()

internal::CaseStateArray thread::MakeShuffledCaseStateArray ( size_t  num_cases)

◆ NonSelectableCase()

Case thread::NonSelectableCase ( )

◆ OnCancel()

Case thread::OnCancel ( )

◆ Post()

void thread::Post ( absl::AnyInvocable< void() && >  work)

◆ PostAfter()

void thread::PostAfter ( absl::Duration  delay,
absl::AnyInvocable< void() && >  work 
)
inline

◆ PostAt()

void thread::PostAt ( absl::Time  deadline,
absl::AnyInvocable< void() && >  work 
)

◆ Rand32()

uint32_t thread::Rand32 ( )

◆ Select()

int thread::Select ( const CaseArray &  cases)
inline

Returns the index of the first case that is ready, blocking until one is.

This is equivalent to calling SelectUntil with an infinite deadline.

Parameters
casesThe array of cases to select from. Usually passed as an initializer list.
Returns
The index of the first case that is ready, or -1 if no case is ready.

◆ SelectUntil()

int thread::SelectUntil ( absl::Time  deadline,
const CaseArray &  cases 
)

Returns the index of the first case that is ready, or -1 if the deadline has expired without any case becoming ready.

Example:

// Try to write against the channel "c", waiting for up to 1ms when there is
// no space immediately available. Returns true if the write was
// successfully enqueued, false otherwise.
bool TryPut(thread::Channel<int>* c, int v) {
absl::Now() + absl::Milliseconds(1),
{c->writer()->OnWrite(v)}) == 0;
}
A Channel is a bounded FIFO queue that allows multiple readers and writers to communicate with each o...
Definition channel.h:83
Writer< T > *absl_nonnull writer()
Returns a Writer that can be used to write items to the channel.
Definition channel.h:334
int SelectUntil(absl::Time deadline, const CaseArray &cases)
Returns the index of the first case that is ready, or -1 if the deadline has expired without any case...
Definition select.cc:55
Note
If a Case transitions into a ready state after the deadline has expired, but before SelectUntil returns, the return value is not guaranteed to be -1 and may instead be the index of that case. However, if -1 is returned, it is guaranteed that no case has proceeded.
Parameters
deadlineThe absolute time until which to wait for a case to become ready.
casesThe array of cases to select from. Usually passed as an initializer list.
Returns
The index of the first case that is ready, or -1 if the deadline has expired.

◆ SetCurrentSchedulerPolicy()

absl::Status thread::SetCurrentSchedulerPolicy ( std::shared_ptr< SchedulerPolicy >  policy)

◆ SetSchedulerParkGuard()

void thread::SetSchedulerParkGuard ( SchedulerParkGuard  guard)

◆ SleepFor()

void thread::SleepFor ( absl::Duration  duration)
inline

Variable Documentation

◆ init_rand32_once

absl::once_flag thread::init_rand32_once
static

◆ kCanParkAwait

constexpr bool thread::kCanParkAwait = true
inlineconstexpr

◆ last_rand32

std::atomic<uint32_t> thread::last_rand32
static