xref: /haiku/src/servers/registrar/mime/RegistrarThreadManager.h (revision 7749d0bb0c358a3279b1b9cc76d8376e900130a5)
1 //----------------------------------------------------------------------
2 //  This software is part of the OpenBeOS distribution and is covered
3 //  by the OpenBeOS license.
4 //---------------------------------------------------------------------
5 /*!
6 	\file RegistrarThreadManager.h
7 	RegistrarThreadManager interface declaration
8 */
9 
10 #ifndef REGISTRAR_THREAD_MANAGER_H
11 #define REGISTRAR_THREAD_MANAGER_H
12 
13 #include <Handler.h>
14 #include <SupportDefs.h>
15 
16 #include <list>
17 
18 class RegistrarThread;
19 
20 class RegistrarThreadManager : public BHandler {
21 public:
22 	RegistrarThreadManager();
23 	~RegistrarThreadManager();
24 
25 	// BHandler virtuals
26 	virtual	void MessageReceived(BMessage* message);
27 
28 	// Thread management functions
29 	status_t LaunchThread(RegistrarThread *thread);
30 	status_t CleanupThreads();
31 	status_t ShutdownThreads();
32 	status_t KillThreads();
33 
34 	uint ThreadCount() const;
35 
36 	static const int kThreadLimit = 12;
37 private:
38 
39 	std::list<RegistrarThread*>::iterator& RemoveThread(std::list<RegistrarThread*>::iterator &i);
40 
41 	std::list<RegistrarThread*> fThreads;
42 	vint32 fThreadCount;
43 };
44 
45 #endif	// THREAD_MANAGER_H
46