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.

note, this is never called if job-que is there.

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.

note, this is never called if job-que is there

18.3. Iteration

for_each(channel: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: Channel? const; blk: block<(arg:auto(TT) const#;info:TypeInfo const? const;var ctx:Context):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: Channel? const; toCh: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: LockBox? const; blk: block<(var res:auto(TT)#):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: 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: 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.