Panda3D
Public Member Functions | List of all members
StreamWrapperBase Class Reference

The base class for both IStreamWrapper and OStreamWrapper, this provides the common locking interface. More...

#include "streamWrapper.h"

Inheritance diagram for StreamWrapperBase:
IStreamWrapper OStreamWrapper StreamWrapper StreamWrapper

Public Member Functions

void acquire ()
 Acquires the internal lock. More...
 
void ref () const
 Increments the reference count. More...
 
void release ()
 Releases the internal lock. More...
 
bool unref () const
 Decrements the reference count. More...
 

Detailed Description

The base class for both IStreamWrapper and OStreamWrapper, this provides the common locking interface.

Definition at line 25 of file streamWrapper.h.

Member Function Documentation

◆ acquire()

void StreamWrapperBase::acquire ( )
inline

Acquires the internal lock.

User code should call this to take temporary possession of the stream and perform direct I/O operations on it, for instance to make several sequential atomic reads. You may not call any of the StreamWrapper methods while the lock is held, other than release().

Use with extreme caution! This is a very low-level, non-recursive lock. You must call acquire() only once, and you must later call release() exactly once. Failing to do so may result in a hard deadlock with no available debugging features.

Definition at line 38 of file streamWrapper.I.

Referenced by IStreamWrapper::get(), OStreamWrapper::put(), OStreamWrapper::seek_eof_write(), IStreamWrapper::seek_gpos_eof(), OStreamWrapper::seek_ppos_eof(), IStreamWrapper::seek_read(), and OStreamWrapper::seek_write().

◆ ref()

void StreamWrapperBase::ref ( ) const
inline

Increments the reference count.

Only has impact if the class that manages this StreamWrapper's lifetime (eg. Multifile) respects it.

Definition at line 66 of file streamWrapper.I.

References AtomicAdjustDummyImpl::inc().

◆ release()

void StreamWrapperBase::release ( )
inline

Releases the internal lock.

Must be called exactly once following a call to acquire(). See the cautions with acquire().

Definition at line 53 of file streamWrapper.I.

Referenced by IStreamWrapper::get(), OStreamWrapper::put(), OStreamWrapper::seek_eof_write(), IStreamWrapper::seek_gpos_eof(), OStreamWrapper::seek_ppos_eof(), IStreamWrapper::seek_read(), and OStreamWrapper::seek_write().

◆ unref()

bool StreamWrapperBase::unref ( ) const
inline

Decrements the reference count.

Only has impact if the class that manages this StreamWrapper's lifetime (eg. Multifile) respects it.

Definition at line 75 of file streamWrapper.I.

References AtomicAdjustDummyImpl::dec().

Referenced by Multifile::close().


The documentation for this class was generated from the following files: