18. Boost package for jobs and threads

|module-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? const; tinfo: auto(TT) const)

each returns auto

argument

argument type

channel

jobque::Channel ? const

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)