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

Warning

This function is deprecated.

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

Warning

This function is deprecated.

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.

18.6. Uncategorized

capture_jobque_lock_box(js: jobque::LockBox? const)

capture_jobque_lock_box returns jobque::LockBox ?

argument

argument type

js

jobque::LockBox ? const

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

release_capture_jobque_lock_box(js: jobque::LockBox? const)

argument

argument type

js

jobque::LockBox ? const

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

gather(ch: jobque::Channel? const; blk: block<(arg:auto(TT) const#):void> const)

gather returns auto

argument

argument type

ch

jobque::Channel ? const

blk

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

reads input from the channel (in order it was pushed) and invokes the block on each input. afterwards input is consumed

gather_ex(ch: jobque::Channel? const; blk: block<(arg:auto(TT) const#;info:rtti::TypeInfo const? const;var ctx:rtti::Context -const):void> const)

gather_ex returns auto

argument

argument type

ch

jobque::Channel ? const

blk

block<(arg:auto(TT) const#;info: rtti::TypeInfo const? const;ctx: rtti::Context ):void> const

reads input from the channel (in order it was pushed) and invokes the block on each input. afterwards input is consumed

gather_and_forward(ch: jobque::Channel? const; toCh: jobque::Channel? const; blk: block<(arg:auto(TT) const#):void> const)

gather_and_forward returns auto

argument

argument type

ch

jobque::Channel ? const

toCh

jobque::Channel ? const

blk

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

reads input from the channel (in order it was pushed) and invokes the block on each input. afterwards input is consumed

peek(ch: jobque::Channel? const; blk: block<(arg:auto(TT) const#):void> const)

peek returns auto

argument

argument type

ch

jobque::Channel ? const

blk

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

reads input from the channel (in order it was pushed) and invokes the block on each input. afterwards input is not consumed

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

for_each_clone 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.

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

pop_one returns auto

Warning

This function is deprecated.

argument

argument type

channel

jobque::Channel ? const

blk

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

reads one command from channel

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

pop_and_clone_one returns auto

argument

argument type

channel

jobque::Channel ? const

blk

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

reads one command from channel

push_batch_clone(channel: jobque::Channel? const; data: array<auto(TT)> const)

push_batch_clone returns auto

argument

argument type

channel

jobque::Channel ? const

data

array<auto(TT)> const

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

push_batch(channel: jobque::Channel? const; data: array<auto?> const)

push_batch returns auto

argument

argument type

channel

jobque::Channel ? const

data

array<auto?> const

pushes values to the channel (at the end)

set(box: jobque::LockBox? const; data: auto(TT) const)

set returns auto

argument

argument type

box

jobque::LockBox ? const

data

auto(TT) const

sets value to the lock box

set(box: jobque::LockBox? const; data: auto? const)

set returns auto

argument

argument type

box

jobque::LockBox ? const

data

auto? const

sets value to the lock box

get(box: jobque::LockBox? const; blk: block<(res:auto(TT) const#):void> const)

get returns auto

argument

argument type

box

jobque::LockBox ? const

blk

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

reads value from the lock box and invokes the block on it

update(box: jobque::LockBox? const; blk: block<(var res:auto(TT)# -const):void> const)

update returns auto

argument

argument type

box

jobque::LockBox ? const

blk

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

update value in the lock box and invokes the block on it

clear(box: jobque::LockBox? const; type_: auto(TT) const)

clear returns auto

argument

argument type

box

jobque::LockBox ? const

type_

auto(TT) const

clear value from the lock box

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

each_clone 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.