Core LibraryTopics

Choose documentation 1

latest

Current version

latest
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Edit this page on GitHub

Client and effect lifetimes

Opening a Scala server owns a Java client. Closing it releases transport and local workers. Killing the tmux daemon is a separate operation and requires a separate ownership decision.

Direct and effect scopes differ

FacadeLifetime
Direct Server.openUse Using.resource or an explicit cleanup scope.
Direct Server.fromJavaWraps the same Java client; closing the facade also closes that client.
Cats Server.resourceAcquires and closes its owned client within a Resource.
Cats Server.fromJavaScopes facade work while leaving the borrowed Java client with its existing owner.

Do not infer borrowing behavior from the method name alone. In particular, direct facade closure and release of a borrowed Cats resource have different effects. The ownership guide specifies both contracts.

Captured data outlives an operation

Direct handles are opaque over their Java objects. They do not make another copy of entity identity. asJava exposes the same handle, with the same ownership and threading obligations.

Captured fields remain observations you can inspect locally. Keeping a handle or an unevaluated effect after a resource body returns does not extend the resource’s lifetime. Executing work through the released effect facade fails.

Cats release rejects new work, cancels queued and running operations, waits for finalizers, and then closes an owned client. Borrowing changes who closes the Java client; it does not remove cleanup of the facade’s own work.

Attachments and observations have their own scopes

An attached control client owns a separate process attachment. Acquire an observation inside that attachment and release it first. Use separate attachments when command cancellation must not end an observation.

A raw Java handle obtained inside an owned scope cannot keep that scope alive. If an external owner closes a borrowed transport while a request is running, preserve the resulting dispatch uncertainty. Do not convert it to a successful empty result or replay the operation automatically.

Run the transport examples and read the ownership guide for the native resource boundaries.

Esc

Type to search.

Reference preview Open reference