[][src]Module glean::dispatcher

A global dispatcher queue.

Example - Global Dispatch queue

The global dispatch queue is pre-configured with a maximum queue size of 100 tasks.

This example is not tested
// Ensure the dispatcher queue is being worked on.
dispatcher::flush_init();

dispatcher::launch(|| {
    println!("Executing expensive task");
    // Run your expensive task in a separate thread.
});

dispatcher::launch(|| {
    println!("A second task that's executed sequentially, but off the main thread.");
});

Structs

Dispatcher

A dispatcher.

Enums

DispatchError

The error returned from operations on the dispatcher

Functions

block_on_queue

Block until all tasks prior to this call are processed.

flush_init

Starts processing queued tasks in the global dispatch queue.

launch

Launches a new task on the global dispatch queue.

try_shutdown

Shuts down the dispatch queue.