18. Boost package for jobs and threads

The JOBQUE boost module implements collection of helper macros and functions to accompany JOBQUE.

All functions and symbols are in “jobque_boost” module, use require to get access to it.

require daslib/jobque_boost

18.1. Function annotations

NewJobMacro

this macro handles new_job and new_thread calls. the call is replaced with new_job_invoke and new_thread_invoke accordingly. a cloning infastructure is generated for the lambda, which is invoked in the new context.

18.2. Invocations

new_job(l: lambda<>)

argument

argument type

l

lambda<>

Create a new job.
  • new context is cloned from the current context.

  • lambda is cloned to the new context.

  • new job is added to the job queue.

  • once new job is invoked, lambda is invoked on the new context on the job thread.

new_thread(l: lambda<>)

argument

argument type

l

lambda<>

Create a new thread
  • new context is cloned from the current context.

  • lambda is cloned to the new context.

  • new thread is created.

  • lambda is invoked on the new context on the new thread.

18.3. Iteration

for_each(channel: jobque::Channel? const; blk: block<(res:auto(TT) const#):void> const)

for_each returns auto

argument

argument type

channel

jobque::Channel ? const

blk

block<(res:auto(TT) const#):void> const

reads input from the channel (in order it was pushed) and invokes the block on each input. stops once channel is depleted (internal entry counter is 0) this can happen on multiple threads or jobs at the same time.

each(channel: jobque::Channel?; tinfo: auto(TT) const)

each returns auto

argument

argument type

channel

jobque::Channel ?

tinfo

auto(TT) const

this iterator is used to iterate over the channel in order it was pushed. iterator stops once channel is depleted (internal entry counter is 0) iteration can happen on multiple threads or jobs at the same time.

18.4. Passing data

push_clone(channel: jobque::Channel? const; data: auto(TT) const)

push_clone returns auto

argument

argument type

channel

jobque::Channel ? const

data

auto(TT) const

clones data and pushed value to the channel (at the end)

push(channel: jobque::Channel? const; data: auto? const)

push returns auto

argument

argument type

channel

jobque::Channel ? const

data

auto? const

pushes value to the channel (at the end)

18.5. Internal capture details

capture_jobque_channel(ch: jobque::Channel? const)

capture_jobque_channel returns jobque::Channel ?

argument

argument type

ch

jobque::Channel ? const

this function is used to capture a channel that is used by the jobque.

capture_jobque_job_status(js: jobque::JobStatus? const)

capture_jobque_job_status returns jobque::JobStatus ?

argument

argument type

js

jobque::JobStatus ? const

this function is used to capture a job status that is used by the jobque.

release_capture_jobque_channel(ch: jobque::Channel? const)

argument

argument type

ch

jobque::Channel ? const

this function is used to release a channel that is used by the jobque.

release_capture_jobque_job_status(js: jobque::JobStatus? const)

argument

argument type

js

jobque::JobStatus ? const

this function is used to release a job status that is used by the jobque.