#include <SharedQueue.h>
Inheritance diagram for OS::SharedQueue:
Public Member Functions | |
SharedQueue (long size=2) | |
virtual String * | className (void) const |
Answer receiver class name. | |
virtual Object * | next (void) |
virtual void | nextPut (Object *object) |
virtual Object * | peek (void) |
virtual long | size (void) |
virtual bool | isEmpty (void) |
Protected Attributes | |
OrderedCollection * | content |
Semaphore * | emptySemaphore |
Semaphore * | accessLock |
|
Definition at line 31 of file SharedQueue.cc. References accessLock, content, emptySemaphore, and OS::Semaphore::forMutualExclusion(). 00032 { 00033 content = new OrderedCollection(size); 00034 accessLock = Semaphore::forMutualExclusion(); 00035 emptySemaphore = new Semaphore; 00036 }
|
|
Answer receiver class name. Because there isn't any standard way to obtain class name this method comes to place. Every class should rewrite this method but many didn't (yet). Reimplemented from Core::Object. Definition at line 39 of file SharedQueue.cc. 00040 { 00041 return new String("SharedQueue"); 00042 }
|
|
Definition at line 81 of file SharedQueue.cc. References content, and Core::Collection::isEmpty(). Referenced by peek().
|
|
Definition at line 45 of file SharedQueue.cc. References accessLock, content, emptySemaphore, Core::OrderedCollection::removeFirst(), OS::Semaphore::signal(), and OS::Semaphore::wait(). 00046 { 00047 Object *data; 00048 00049 emptySemaphore->wait(); 00050 accessLock->wait(); 00051 data = content->removeFirst(); 00052 accessLock->signal(); 00053 return data; 00054 }
|
|
Definition at line 56 of file SharedQueue.cc. References accessLock, Core::OrderedCollection::addLast(), content, emptySemaphore, OS::Semaphore::signal(), and OS::Semaphore::wait(). 00057 { 00058 accessLock->wait(); 00059 content->addLast(object); 00060 emptySemaphore->signal(); 00061 accessLock->signal(); 00062 }
|
|
Definition at line 64 of file SharedQueue.cc. References accessLock, content, Core::OrderedCollection::first(), isEmpty(), nil, OS::Semaphore::signal(), and OS::Semaphore::wait(). 00065 { 00066 Object *data; 00067 00068 accessLock->wait(); 00069 if (isEmpty()) data = nil; 00070 else data = content->first(); 00071 accessLock->signal(); 00072 return data; 00073 }
|
|
Definition at line 75 of file SharedQueue.cc. References content, and Core::OrderedCollection::size().
|
|
Definition at line 39 of file SharedQueue.h. Referenced by next(), nextPut(), peek(), and SharedQueue(). |
|
Definition at line 37 of file SharedQueue.h. Referenced by isEmpty(), next(), nextPut(), peek(), SharedQueue(), and size(). |
|
Definition at line 38 of file SharedQueue.h. Referenced by next(), nextPut(), and SharedQueue(). |