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<():void>)
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.

Arguments
  • l : lambda<void>

new_thread(l: lambda<():void>)
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.

Arguments
  • l : lambda<void>

18.3. Iteration

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

Warning

This function is deprecated.

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.

Arguments
each(channel: Channel?; tinfo: auto(TT)) : auto()

Warning

This function is deprecated.

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.

Arguments
  • channel : Channel ?

  • tinfo : auto(TT)

18.4. Passing data

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

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

Arguments
  • channel : Channel ?

  • data : auto(TT)

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

pushes value to the channel (at the end)

Arguments

18.5. Internal capture details

capture_jobque_channel(ch: Channel?) : Channel?()

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

Arguments
capture_jobque_job_status(js: JobStatus?) : JobStatus?()

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

Arguments
release_capture_jobque_channel(ch: Channel?)

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

Arguments
release_capture_jobque_job_status(js: JobStatus?)

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

Arguments

18.6. Uncategorized

capture_jobque_lock_box(js: LockBox?) : LockBox?()

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

Arguments
release_capture_jobque_lock_box(js: LockBox?)

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

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

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

Arguments
  • ch : Channel ?

  • blk : block<(arg:auto(TT)#):void>

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

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

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

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

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

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

Arguments
  • ch : Channel ?

  • blk : block<(arg:auto(TT)#):void>

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

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.

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

Warning

This function is deprecated.

reads one command from channel

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

reads one command from channel

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

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

Arguments
  • channel : Channel ?

  • data : array<auto(TT)>

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

pushes values to the channel (at the end)

Arguments
  • channel : Channel ?

  • data : array<auto?>

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

clones data and sets value to the lock box

Arguments
set(box: LockBox?; data: auto?) : auto()

sets value to the lock box

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

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

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

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

Arguments
clear(box: LockBox?; type_: auto(TT)) : auto()

clear value from the lock box

Arguments
each_clone(channel: Channel?; tinfo: auto(TT)) : auto()

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.

Arguments
  • channel : Channel ?

  • tinfo : auto(TT)