TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class RingBuffer in Tinman.Core.Threading

A ring buffer management structure, without any actual data storage.

sealed class RingBuffer extends Disposable
  implements ICapacity

Public / Attributes

Capacity

Returns the capacity of this object.

public property Capacity { get }
type int32
value [>=0] The capacity, in elements.
implements ICapacity.Capacity

LifecycleState

Returns the lifecycle state of this object.

public virtual property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited Disposable.LifecycleState

Readable

Returns the number of readable buffer elements.

[BeginEnd]
public property Readable { get }
type int32
value [>=0] The number of readable buffer elements.

See also:

Read
ReadFinish

Writeable

Returns the number of writeable buffer elements.

[BeginEnd]
public property Writeable { get }
type int32
value [>=0] The number of writeable buffer elements.

See also:

Write
WriteFinish

Public / Constructors

RingBuffer

Creates a new instance of RingBuffer.

public constructor RingBuffer (int32 capacity, [Owner] Monitor monitor = null)
params capacity [>0] The buffer capacity.
  monitor The monitor for thread synchronization. If null, a private monitor will be created. Defaults to null.

Remarks:

All methods of RingBuffer must only be called when the calling thread owns the given monitor.

Public / Methods

AcquireTry

Acquires a strong reference to this disposable object.

[OwnerReturn, ThreadSafe]
public method AcquireTry ()
type IDisposable
returns this if a new strong reference has been acquired, null if this object is already being disposed.
inherited Disposable.AcquireTry

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Begin

Calls the Begin method on the Monitor object that belongs to this RingBuffer.

public method Begin ()

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
public method Dispose ()
inherited Disposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

End

Calls the End method on the Monitor object that belongs to this RingBuffer.

public method End ()

Notify

Calls the NotifyWaiting method on the Monitor object that belongs to this RingBuffer.

[BeginEnd]
public method Notify ()

Read

Reads a single buffer element.

public method Read (int32 n = 1)
type int32
params n [0..Readable] The number of buffer elements that will be read. Defaults to 1.
returns The buffer element index.

See also:

Readable
ReadFinish

ReadFinish

Finished reading all available buffer elements.

[BeginEnd]
public method ReadFinish ()

Remarks:

After this method returns, the Notify method must be called.

See also:

Readable
Read

Wait

Calls the WaitForNotify method on the Monitor object that belongs to this RingBuffer.

[BeginEnd]
public method Wait ()

Write

Writes a number of buffer elements.

public method Write (int32 n = 1)
type int32
params n [0..Writeable] The number of buffer elements that will be written. Defaults to 1.
returns The buffer index of the first element to write.

See also:

Writeable
WriteFinish

WriteFinish

Finishes writing a number of buffer elements.

[BeginEnd]
public method WriteFinish ()

Remarks:

After this method returns, the Notify method must be called.

See also:

Writeable
Write