1// RequestPortPool.h 2 3#ifndef USERLAND_FS_REQUEST_PORT_POOL_H 4#define USERLAND_FS_REQUEST_PORT_POOL_H 5 6#include <OS.h> 7 8#include "Locker.h" 9 10namespace UserlandFSUtil { 11 12class RequestPort; 13 14} 15 16using UserlandFSUtil::RequestPort; 17 18class RequestPortPool : public Locker { 19public: 20 RequestPortPool(); 21 ~RequestPortPool(); 22 23 status_t InitCheck() const; 24 25 bool IsDisconnected() const; 26 27 status_t AddPort(RequestPort* port); 28 29 RequestPort* AcquirePort(); 30 void ReleasePort(RequestPort* port); 31 32private: 33 friend class KernelDebug; 34 35 struct PortAcquirationInfo { 36 RequestPort* port; 37 thread_id owner; 38 int32 count; 39 }; 40 41 PortAcquirationInfo* fPorts; 42 int32 fPortCount; 43 int32 fFreePorts; 44 sem_id fFreePortSemaphore; 45 volatile bool fDisconnected; 46}; 47 48#endif // USERLAND_FS_REQUEST_PORT_POOL_H 49