StrLock

class StrLock(val name: String) : Lock

Simple implementation of Lock based around string IDs.

Constructors

Link copied to clipboard
constructor(name: String)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open fun derive(): Lock

Create a new Lock derived from this Lock. The new lock should have a unique identity (it should not be equivalent to any other lock) but should be obviously associated with this one.

open override fun derive(annotation: String?): Lock.StrLock

Create a new Lock derived from this Lock. The new lock should have a unique identity (it should not be equivalent to any other lock) but should be obviously associated with this one. The provided annotation may optionally be used to provide additional information.

Link copied to clipboard
open override fun getFriendlyName(): String

A name that could be used to refer to this lock in error messages or logs. Hopefully descriptive enough to locate when problems occur.

Link copied to clipboard
open fun onAcquire(source: ITask<*>)

Called internally when this lock becomes 'acquired' (in use) by a Task.

Link copied to clipboard
open fun onRelease(source: ITask<*>)

Called internally when this lock is no longer 'acquired' by any Task and becomes able to be claimed by any task.

Link copied to clipboard
open fun onTransfer(source: ITask<*>, destination: ITask<*>)

Called internally when this lock is explicitly transferred to another Task. Transferring locks prevents 'lock stealing' during the small transition period due to .then().