lsst.utils  14.0-8-g1f982c9
Public Member Functions | Public Attributes | List of all members
lsst.utils.multithreading.SharedData.SharedData Class Reference
Inheritance diagram for lsst.utils.multithreading.SharedData.SharedData:

Public Member Functions

def __init__ (self, needLockOnRead=True, data=None, cond=None)
 
def __enter__ (self)
 
def __exit__ (self, exc_info)
 
def __getattribute__ (self, name)
 
def __setattr__ (self, name, value)
 
def initData (self, data)
 
def dir (self)
 

Public Attributes

 acquire
 
 release
 
 notify
 
 notifyAll
 
 wait
 

Detailed Description

a lock-protected container for data that can be shared amongst threads.

This container holds data that is intended to be shared amongst multiple
threads.  In order to update or (optionally) examine the data, one must
first aquire the lock associated with the container.

This container also behaves like a threading.Container, via its
wait(), notify(), and notifyAll() functions.  Also like Condition,
acquire() is reentrant.

SharedData instances may be used with the with statement:

  sd = SharedData()
  with sd:
      sd.blah = 1

The with statement will acquire the lock and ensure that it is released
when its block is exited.

Definition at line 31 of file SharedData.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.utils.multithreading.SharedData.SharedData.__init__ (   self,
  needLockOnRead = True,
  data = None,
  cond = None 
)
create and initialize the shared data
@param needLockOnRead   if true (default), acquiring the lock will
      be needed when reading the data.  This is recommended
      if the data items are anything but primitive types;
      otherwise, a compound data item (e.g. of type dict)
      could be updated without acquiring a lock.
@param data   a dictionary of data to initialize the container with.
      This is done by calling initData().  Set this value to
      False when calling from a subclass constructor; this
      will allow any non-protected attributes to be set via
      the subclass's constructor.  If None is given (default),
      it is assumed that all new attributes will be considered
      protected data.
@param cond   Reuse this existing Condition instance to protect this
        container

Definition at line 53 of file SharedData.py.

Member Function Documentation

◆ __enter__()

def lsst.utils.multithreading.SharedData.SharedData.__enter__ (   self)

Definition at line 92 of file SharedData.py.

◆ __exit__()

def lsst.utils.multithreading.SharedData.SharedData.__exit__ (   self,
  exc_info 
)

Definition at line 95 of file SharedData.py.

◆ __getattribute__()

def lsst.utils.multithreading.SharedData.SharedData.__getattribute__ (   self,
  name 
)

Definition at line 98 of file SharedData.py.

◆ __setattr__()

def lsst.utils.multithreading.SharedData.SharedData.__setattr__ (   self,
  name,
  value 
)

Definition at line 106 of file SharedData.py.

◆ dir()

def lsst.utils.multithreading.SharedData.SharedData.dir (   self)

Definition at line 140 of file SharedData.py.

◆ initData()

def lsst.utils.multithreading.SharedData.SharedData.initData (   self,
  data 
)
initialize the container with the data from a dictionary.
@param data   a dictionary of data to initialize the container with.
      Attributes will be added to this container with names
      matching the given the dictionary's key names and
      initialized to their corresponding values.  The keys
      cannot match an existing function (or internal attribute)
      name.
@throws ValueError   if the dictionary has a key that conflicts with
      an existing function or internal attribute name.

Definition at line 116 of file SharedData.py.

Member Data Documentation

◆ acquire

lsst.utils.multithreading.SharedData.SharedData.acquire

Definition at line 77 of file SharedData.py.

◆ notify

lsst.utils.multithreading.SharedData.SharedData.notify

Definition at line 79 of file SharedData.py.

◆ notifyAll

lsst.utils.multithreading.SharedData.SharedData.notifyAll

Definition at line 80 of file SharedData.py.

◆ release

lsst.utils.multithreading.SharedData.SharedData.release

Definition at line 78 of file SharedData.py.

◆ wait

lsst.utils.multithreading.SharedData.SharedData.wait

Definition at line 81 of file SharedData.py.


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