Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SharedTimer

A Shared Timer that can be used to share a single timer object with multiple owners.

Hierarchy

Index

Constructors

constructor

Properties

ptr

ptr: number

Methods

dispose

  • dispose(): void
  • Disposes the object, allowing it to clean up all of its memory. You need to call this for every object that you don't use anymore and hasn't already been disposed.

    Returns void

read

  • Requests read access to the timer that is being shared. This blocks the thread as long as there is an active write lock. Dispose the read lock when you are done using the timer.

    Returns TimerReadLock

readWith

  • readWith<T>(action: (timer: TimerRef) => T): T

replaceInner

  • replaceInner(timer: Timer): void
  • Replaces the timer that is being shared by the timer provided. This blocks the thread as long as there are active write or read locks. Everyone who is sharing the old timer will share the provided timer after successful completion.

    Parameters

    Returns void

share

  • Creates a new shared timer handle that shares the same timer. The inner timer object only gets disposed when the final handle gets disposed.

    Returns SharedTimer

with

  • Allows for scoped usage of the object. The object is guaranteed to get disposed once this function returns. You are free to dispose the object early yourself anywhere within the scope. The scope's return value gets carried to the outside of this function.

    Type parameters

    • T

    Parameters

    Returns T

write

  • Requests write access to the timer that is being shared. This blocks the thread as long as there are active write or read locks. Dispose the write lock when you are done using the timer.

    Returns TimerWriteLock

writeWith

Generated using TypeDoc