Skip to main content

Module threading_functions

Module threading_functions 

Source
Expand description

This module contains a few helper.

For example, you can find a function for determining number of threads available in system. The sleep family of functions are also here.

Constants§

MICROS_PER_SEC
MILLIS_PER_SEC
NANOS_PER_SEC

Functions§

async_sleep
block_on_task
Given a closure task, push it onto the current tokio runtime for execution. Every [DEFAULT_SLEEP_DURATION] seconds, we check if the task has concluded. Once the task has concluded, we call tokio::block_on to resolve and extract the task result.
get_default_system_thread_count
init_runtime
lock_read
Obtain read guard to standard spin lock such that you have a more ergonomic interface to locked data.
lock_write
Obtain write guard to standard spin lock such that you have a more ergonomic interface to locked data.
new_lock
process_read_critical_section
This function gives you read access to underlying structure.
process_write_critical_section
This function gives you write access to underlying structure.
sleep
spawn_blocking_sync_task
This helper should be used for spawning tasks that would normally block the async runtime. However, here we use the appropriate tokio facilities to signal the runtime on how to handle this, potentially blocking, task. For waiting on potentially blocking futures, use block_on_task instead!