Base class for representation of one case in multi chain select.
More...
#include <mchain_select_ifaces.hpp>
Base class for representation of one case in multi chain select.
- Attention
- Objects of this class are not copyable nor moveable.
- Since
- v.5.5.16
◆ select_case_t() [1/3]
so_5::mchain_props::select_case_t::select_case_t |
( |
mchain_t |
chain | ) |
|
|
inline |
Initialized constructor.
- Parameters
-
chain | Message chain for that this select_case is created. |
◆ select_case_t() [2/3]
so_5::mchain_props::select_case_t::select_case_t |
( |
const select_case_t & |
| ) |
|
|
delete |
◆ select_case_t() [3/3]
so_5::mchain_props::select_case_t::select_case_t |
( |
select_case_t && |
| ) |
|
|
delete |
◆ ~select_case_t()
virtual so_5::mchain_props::select_case_t::~select_case_t |
( |
| ) |
|
|
inlinevirtual |
◆ chain()
const mchain_t& so_5::mchain_props::select_case_t::chain |
( |
| ) |
const |
|
inlinenoexcept |
Get the underlying mchain.
- Since
- v.5.5.17
◆ giveout_next()
select_case_t* so_5::mchain_props::select_case_t::giveout_next |
( |
| ) |
|
|
inline |
Get the next item in the current queue to which select_case belongs at this moment and drop this pointer to nullptr value.
This method must be used if select_case object must be extracted from the current queue.
- See also
- select_case_t::m_next.
◆ notify()
void so_5::mchain_props::select_case_t::notify |
( |
| ) |
|
|
inlinenoexcept |
Notification for all waiting select_cases.
This method is called by mchain if empty mchain becomes non-empty or if it is closed.
This method does notification for all members of select_case queue. It means that mchain calls notify() for the head of the queue and that head does notification for all other queue's members.
◆ on_select_finish()
void so_5::mchain_props::select_case_t::on_select_finish |
( |
| ) |
|
|
inlinenoexcept |
Reaction to the end of select work.
- Attention
- This method must be called before return from select() function to ensure that mchain do not hold a pointer to non-existent select_case object.
-
This method must not throw because it will be called from destructor of RAII wrappers.
◆ query_next()
select_case_t* so_5::mchain_props::select_case_t::query_next |
( |
| ) |
const |
|
inline |
Simple access to next item in the current queue to which select_case object belongs at this moment.
- See also
- select_case_t::m_next
◆ set_next()
void so_5::mchain_props::select_case_t::set_next |
( |
select_case_t * |
next | ) |
|
|
inline |
◆ try_handle_extracted_message()
◆ try_receive()
An attempt to extract and handle a message from mchain.
- Note
- This method returns immediately if mchain is empty. In this case select_case object will stay in select_case queue inside mchain.
◆ m_chain
mchain_t so_5::mchain_props::select_case_t::m_chain |
|
private |
Message chain to receive message from.
◆ m_next
select_case_t* so_5::mchain_props::select_case_t::m_next = nullptr |
|
private |
Next select_case in queue.
A select_case object can be included in one of two different queues:
- in select queue inside mchain (in this case m_notificator is not nullptr). Next item in queue belongs to different select(). This item must be notified in notify() method.
- in ready to use select_case queue. The select_case is added to that queue when select_case in notified by mchain. The next item in queue belongs to the same select().
◆ m_notificator
Notificator to be used for notify sleeping thread.
Can be null. It means that select_case is not used in select queue for the mchain at that moment.
There are just two methods where m_notificator changes its value:
- try_receive() where m_notificator receives an actual pointer (m_notificator can become nullptr again in try_receive() if mchain has messages or was closed);
- on_select_finish() where m_notificator receives nullptr value if it wasn't null yet.
It the previous versions of SObjectizer m_notificator received nullptr value during notification of new messages arrival or closing of mchain. But this lead to data races and the behaviour was changed. Now m_notificator can hold an actual pointer even after notification was initiated.
The documentation for this class was generated from the following file: