# LV2 Worker

http://lv2plug.in/ns/ext/worker
Support for a non-realtime plugin worker method.

Version | 1.2
Date | 2018-03-16
Discuss | devel@lists.lv2plug.in (subscribe)
Developer | David Robillard

- Index
- Reference
- History
- API

This extension allows plugins to schedule work that must be performed in another thread. Plugins can use this interface to safely perform work that is not real-time safe, and receive the result in the run context. The details of threading are managed by the host, allowing plugins to be simple and portable while using resources more efficiently.

This interface is designed to gracefully support single-threaded synchronous execution, which allows the same code to work with sample accuracy for offline rendering. For example, a sampler plugin may schedule a sample to be loaded from disk in another thread. During live execution, the host will call the plugin's work method from another thread, and deliver the result to the audio thread when it is finished. However, during offline export, the scheduled load would be executed immediately in the same thread. This enables reproducible offline rendering, where any changes affect the output immediately regardless of how long the work takes to execute.

## Index

Instances | Files
--- | ---
interface schedule | lv2-worker.doap.ttl worker.h worker.ttl

## Reference

### Instance work:interface

The work interface provided by a plugin, LV2_Worker_Interface.

    @prefix work: <http://lv2plug.in/ns/ext/worker#> .

    <plugin>
        a lv2:Plugin ;
        lv2:extensionData work:interface .

Type | lv2:ExtensionData

### Instance work:schedule

The work scheduling feature provided by a host, LV2_Worker_Schedule.

If the host passes this feature to LV2_Descriptor::instantiate, the plugin MAY use it to schedule work in the audio thread, and MUST NOT call it in any other context. Hosts MAY pass this feature to other functions as well, in which case the plugin MAY use it to schedule work in the calling context. The plugin MUST NOT assume any relationship between different schedule features.

Type | lv2:Feature

## History

Version 1.2 (2016-07-31)
  - Improve documentation.
Version 1.0 (2012-04-17)
  - Initial release.