Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

IResource Struct Reference

Inheritance diagram for IResource:

IConduit Resource Conduit SocketConduit Conduit Socket FileConduit FileConduit DatagramSocket ServerSocket SocketConduit MulticastSocket List of all members.

Public Member Functions

protected void closure ()
Object getLock ()
void setLock (Object lock)
void acquire ()
bool acquireIfOpen ()
void close ()

Detailed Description

Protocol for acquiring and releasing a resource such as a file, or socket. This isn't strictly necessary, but will aid migration to a multi-threaded runtime environment.

Definition at line 46 of file IResource.d.


Member Function Documentation

protected void closure  ) 
 

Subclasses must implement closure mechanics. This is invoked when the number of close() invocations match that of aquire() -- the latter is typically called immediately following the successful construction of an IResource implementation; one should expect close to be required at least once.

Reimplemented in Conduit, FileConduit, Resource, and Socket.

Object getLock  ) 
 

Return the lock used by this resource

Reimplemented in Resource.

void setLock Object  lock  ) 
 

Set an alternate lock. Typically one would use this to synchronize multiple different Resources via a common object.

Reimplemented in Resource.

void acquire  ) 
 

hold a reference to this resource. The caller is now responsible for invoking close() upon this resource;

Reimplemented in Resource.

bool acquireIfOpen  ) 
 

If this resource is still open, acquire it and return true. This is a threadsafe test-and-set mechanism that fails only if the resource is already closed, or was never opened.

Note that you are responsible for invoking close() whenever this method returns true.

Reimplemented in Resource.

void close  ) 
 

release a reference to this resource

Reimplemented in Resource.

Referenced by HttpClient::close(), ConnectionPool::PoolConnection::close(), HttpBridge::cross(), ClusterThread::run(), and testClient().


The documentation for this struct was generated from the following file:
Generated on Sun Nov 7 19:07:06 2004 for Mango by doxygen 1.3.6