Skip to main content

client

Function client 

Source
pub fn client() -> Client
Expand description

Returns the jobserver client previously initialized by initialize_checked.

ยงAssumptions about holding jobserver tokens

Rustc process must always hold a single token to avoid being permanently starved and blocked.

  • If the jobserver is inherited from a higher level build tool, the assumption is that the tool will hold the token and not release it until the rustc process exits.
  • If the jobserver is owned by the current rustc, the token is acquired by default_client.

To avoid releasing the last token, users of the client returned by this function must ensure that they never release more tokens than was previously explicitly acquired. Example of a sequence that can accidentally release the last token: release_raw -> wait -> acquire_raw. To avoid situations like this use the jobserver::Proxy wrapper instead, it will ensure that the last token is never released.