virtual PtGate* makeNew() const = 0;The
makeNew
method returns a new object of the same class as the object it is called for, which is created on the heap. For example, a hypothetical SunLWPGate object would return a new SunLWPGate. The other two methods are protected. They are:
virtual void lock() = 0;The first call requests access for a resource; the second call releases access. If code in another thread calls
virtual void unlock() = 0;
lock()
on the same PtGate after lock()
has already been called on it, the second call will block until the first thread does an unlock()
call. Note that two successive calls to lock()
on the same PtGate from the same thread will cause that thread to hang. It is for this reason that these calls are protected, not public. Access to PtGates by user code is accomplished by means of another class, CriticalSection. The CriticalSection class is a friend of class PtGate.