YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
yaclib::Strand Class Reference

#include <strand.hpp>

Inheritance diagram for yaclib::Strand:
[legend]
Collaboration diagram for yaclib::Strand:
[legend]

Public Member Functions

 Strand (IExecutorPtr e) noexcept
 
 ~Strand () noexcept override
 
Type Tag () const noexcept final
 Return type of this executor.
 
bool Alive () const noexcept final
 Return true if executor still alive, that means job passed to submit will be Call.
 
void Submit (Job &job) noexcept final
 Submit given job.
 
- Public Member Functions inherited from yaclib::IRef
virtual void IncRef () noexcept
 Increments reference counter.
 
virtual void DecRef () noexcept
 Decrements reference counter.
 
virtual ~IRef () noexcept=default
 

Additional Inherited Members

- Public Types inherited from yaclib::IExecutor
enum class  Type : unsigned char {
  Custom = 0 , Inline = 1 , Manual = 2 , Strand = 3 ,
  SingleThread = 4 , FairThreadPool = 5 , GolangThreadPool = 6
}
 

Detailed Description

Definition at line 10 of file strand.hpp.

Constructor & Destructor Documentation

◆ Strand()

yaclib::Strand::Strand ( IExecutorPtr  e)
explicitnoexcept

Definition at line 9 of file strand.cpp.

References yaclib::MakeContract().

◆ ~Strand()

yaclib::Strand::~Strand ( )
overridenoexcept

Definition at line 12 of file strand.cpp.

References YACLIB_DEBUG.

Member Function Documentation

◆ Alive()

bool yaclib::Strand::Alive ( ) const
finalvirtualnoexcept

Return true if executor still alive, that means job passed to submit will be Call.

Implements yaclib::IExecutor.

Definition at line 20 of file strand.cpp.

References yaclib::IExecutor::Alive().

◆ Submit()

void yaclib::Strand::Submit ( Job job)
finalvirtualnoexcept

Submit given job.

This method may either Call or Drop the job

This method increments reference counter if task is submitted.

Call if executor is Alive, otherwise Drop

Parameters
jobjob to execute

Implements yaclib::IExecutor.

Definition at line 24 of file strand.cpp.

References yaclib::IRef::IncRef(), and yaclib::MakeContract().

◆ Tag()

IExecutor::Type yaclib::Strand::Tag ( ) const
finalvirtualnoexcept

Return type of this executor.

Implements yaclib::IExecutor.

Definition at line 16 of file strand.cpp.

References yaclib::IExecutor::Strand.


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