xref: /haiku/src/add-ons/kernel/file_systems/netfs/server/GlobalBlockerPool.cpp (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 // GlobalBlockerPool.cpp
2 
3 #include <new>
4 
5 #include "GlobalBlockerPool.h"
6 
7 // CreateDefault
8 status_t
9 GlobalBlockerPool::CreateDefault()
10 {
11 	if (sPool)
12 		return B_OK;
13 
14 	BlockerPool* pool = new(std::nothrow) BlockerPool;
15 	if (!pool)
16 		return B_NO_MEMORY;
17 
18 	status_t error = pool->InitCheck();
19 	if (error != B_OK) {
20 		delete pool;
21 		return error;
22 	}
23 
24 	sPool = pool;
25 	return B_OK;
26 }
27 
28 // DeleteDefault
29 void
30 GlobalBlockerPool::DeleteDefault()
31 {
32 	if (sPool) {
33 		delete sPool;
34 		sPool = NULL;
35 	}
36 }
37 
38 // GetDefault
39 BlockerPool*
40 GlobalBlockerPool::GetDefault()
41 {
42 	return sPool;
43 }
44 
45 // sPool
46 BlockerPool* GlobalBlockerPool::sPool = NULL;
47