TuningFork.SonicPi.Current (TuningFork v0.1.4)

Copy Markdown View Source

The TuningFork.SonicPi.Thread the calling process is running.

Summary

Functions

Draw from the thread's generator with fun and keep the generator it returns.

The process's thread, started at time zero as an ambient thread if it has none.

Replace the process's thread.

Replace the process's thread with fun of it.

Run fun with thread as the process's thread, then put back whatever was there.

Functions

draw(fun)

@spec draw((TuningFork.Rand.t() -> {value, TuningFork.Rand.t()})) :: value
when value: term()

Draw from the thread's generator with fun and keep the generator it returns.

get()

@spec get() :: TuningFork.SonicPi.Thread.t()

The process's thread, started at time zero as an ambient thread if it has none.

put(thread)

Replace the process's thread.

update(fun)

Replace the process's thread with fun of it.

within(thread, fun)

@spec within(TuningFork.SonicPi.Thread.t(), (-> result)) :: result when result: term()

Run fun with thread as the process's thread, then put back whatever was there.