1// PortReleaser.h
2
3#ifndef USERLAND_FS_PORT_RELEASER_H
4#define USERLAND_FS_PORT_RELEASER_H
5
6#include "FileSystem.h"
7#include "RequestPortPool.h"
8
9// PortReleaser
10class PortReleaser {
11public:
12	PortReleaser(RequestPortPool* portPool, RequestPort* port)
13		: fPortPool(portPool),
14		  fPort(port)
15	{
16	}
17
18	~PortReleaser()
19	{
20		if (fPort && fPortPool)
21			fPortPool->ReleasePort(fPort);
22	}
23
24private:
25	RequestPortPool*	fPortPool;
26	RequestPort*		fPort;
27};
28
29#endif	// USERLAND_FS_PORT_RELEASER_H
30