mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd:🆑 Check and throw for unavailability in work item ctor.
This commit is contained in:
parent
858b56e4fe
commit
9401c206a1
2 changed files with 9 additions and 2 deletions
|
@ -23,6 +23,7 @@ namespace ircd::cl
|
|||
|
||||
IRCD_EXCEPTION(ircd::error, error)
|
||||
IRCD_EXCEPTION(error, opencl_error)
|
||||
IRCD_EXCEPTION(error, unavailable)
|
||||
|
||||
using read_closure = std::function<void (const_buffer)>;
|
||||
using write_closure = std::function<void (mutable_buffer)>;
|
||||
|
@ -67,7 +68,7 @@ struct ircd::cl::work
|
|||
void wait(const uint = 0);
|
||||
|
||||
explicit work(void *const &handle); // note: RetainEvent()
|
||||
work() noexcept;
|
||||
work();
|
||||
work(work &&) noexcept;
|
||||
work(const work &) = delete;
|
||||
work &operator=(work &&) noexcept;
|
||||
|
|
|
@ -1938,8 +1938,14 @@ noexcept
|
|||
//
|
||||
|
||||
ircd::cl::work::work()
|
||||
noexcept
|
||||
{
|
||||
if(unlikely(!cl::linkage || run::level != run::level::RUN))
|
||||
throw unavailable
|
||||
{
|
||||
"Unable to submit work items at this time."
|
||||
};
|
||||
|
||||
assert(cl::linkage);
|
||||
assert(ircd::run::level == run::level::RUN);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue