LLFIO  v2.00
llfio_v2_xxx::dynamic_thread_pool_group::work_item Class Referenceabstract

An individual item of work within the work group. More...

#include "dynamic_thread_pool_group.hpp"

Inheritance diagram for llfio_v2_xxx::dynamic_thread_pool_group::work_item:
llfio_v2_xxx::dynamic_thread_pool_group::io_aware_work_item

Public Member Functions

dynamic_thread_pool_groupparent () const noexcept
 Returns the parent work group between successful submission and just before group_complete().
 
virtual intptr_t next (deadline &d) noexcept=0
 
virtual result< void > operator() (intptr_t work) noexcept=0
 
virtual void group_complete (const result< void > &cancelled) noexcept
 

Protected Member Functions

constexpr bool _has_timer_set_relative () const noexcept
 
constexpr bool _has_timer_set_absolute () const noexcept
 
constexpr bool _has_timer_set () const noexcept
 
 work_item (const work_item &o)=delete
 
 work_item (work_item &&o) noexcept
 
work_itemoperator= (const work_item &)=delete
 
work_itemoperator= (work_item &&)=delete
 

Friends

class dynamic_thread_pool_group_impl
 

Detailed Description

An individual item of work within the work group.

Member Function Documentation

◆ group_complete()

virtual void llfio_v2_xxx::dynamic_thread_pool_group::work_item::group_complete ( const result< void > &  cancelled)
inlinevirtualnoexcept

Invoked by the i/o thread pool when all work in this thread pool group is complete.

cancelled indicates if this is an abnormal completion. If its error compares equal to errc::operation_cancelled, then stop() was called.

Just before this is called for all work items submitted, the group becomes reset to fresh, and parent() becomes null. You can resubmit this work item, but do not submit other work items until their group_complete() has been invoked.

Note that this function is called from multiple kernel threads.

dynamic_thread_pool_group::current_work_item() may have any value during this call.

324 { (void) cancelled; }

◆ next()

virtual intptr_t llfio_v2_xxx::dynamic_thread_pool_group::work_item::next ( deadline d)
pure virtualnoexcept

Invoked by the i/o thread pool to determine if this work item has more work to do.

Returns
If there is no work currently available to do, but there might be some later, you should return zero. You will be called again later after other work has been done. If you return -1, you are saying that no further work will be done, and the group need never call you again. If you have more work you want to do, return any other value.
Parameters
dOptional delay before the next item of work ought to be executed (return != 0), or next() ought to be called again to determine the next item (return == 0). On entry d is set to no delay, so if you don't modify it, the next item of work occurs as soon as possible.

Note that this function is called from multiple kernel threads. You must NOT do any significant work in this function. In particular do NOT call any dynamic thread pool group function, as you will experience deadlock.

dynamic_thread_pool_group::current_work_item() may have any value during this call.

◆ operator()()

virtual result<void> llfio_v2_xxx::dynamic_thread_pool_group::work_item::operator() ( intptr_t  work)
pure virtualnoexcept

Invoked by the i/o thread pool to perform the next item of work.

Returns
Any failure causes all remaining work in this group to be cancelled as soon as possible.
Parameters
workThe value returned by next().

Note that this function is called from multiple kernel threads, and may not be the kernel thread from which next() was called.

dynamic_thread_pool_group::current_work_item() will always be this during this call.


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