On this page:
maybe-jobserver-client
maybe-jobserver-jobs

4.7 Jobserver Client🔗ℹ

The zuo/jobserver module is reprovided by zuo.

Added in version 1.1.

procedure

(maybe-jobserver-client)

  (or/c ((or/c 'get 'put) . -> . void?) #f)
Returns a procedure if a jobserver configuration is found via the MAKEFLAGS environment variable, #f otherwise. That environment variable is normally set by GNU Make when it runs a target command and when -j was provided to make. A jobserver configuration allows parallelism to span make and other processes, such as a zuo process, through a shared pool of jobserver tokens. In other words, a -j flag to make gets propagated to zuo.

When a procedure is returned, it accepts one argument: 'get or 'put. Apply the procedure with 'get to acquire a jobserver token, and apply the procedure with 'put to release a previously acquired token. The implicit jobserver token that belongs to the zuo process should be taken explicitly with 'get and released with 'put.

The maybe-jobserver-client procedure must be called in a threading context. When it returns a procedure, that procedure must also be called (with 'get or 'put) in the same threading context.

procedure

(maybe-jobserver-jobs)  (or/c integer? #f)

Similar to maybe-jobserver-client, but polls the jobserver (if any) to determine how many job tokens appear to be immediately available. The result is that number, or #f if no jobserver configuration is found.

Using maybe-jobserver-client to cooperate interactively with the jobserver is normally better, but maybe-jobserver-jobs can be useful to chaining to another tool that accepts job count as a number.

Unlike maybe-jobserver-client, maybe-jobserver-jobs does not need to be called in a threading context.