2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * ControllersFactory.h
19 * Created on: 2010-06-28
23 #ifndef WRTDEVICEAPIS_COMMONS_THREADPOOL_H_
24 #define WRTDEVICEAPIS_COMMONS_THREADPOOL_H_
27 #include <dpl/thread.h>
28 #include <dpl/event/main_event_dispatcher.h>
29 #include <dpl/event/thread_event_dispatcher.h>
30 #include <dpl/event/event_support.h>
32 namespace WrtDeviceApis {
63 PLUGIN_TEMPLETE_THREAD,
82 class ThreadPool : private DPL::Noncopyable
85 typedef std::map<ThreadEnum::Enumeration, DPL::Thread*> ThreadHandleMap;
86 ThreadHandleMap m_threadHandlers;
87 DPL::Mutex m_threadHandlersMutex;
89 DPL::Thread *getThreadHandleCreateIfNotExists(ThreadEnum::Enumeration type);
91 //DPL::MainEventDispatcher m_mainEventDispatcher;
99 * @throws: WrtDeviceApis::Commons::InvalidArgumentException
101 DPL::Thread * getThreadRef(ThreadEnum::Enumeration type);
104 * Get proper dispatcher for current calling thread
106 DPL::Event::AbstractEventDispatcher *getDispatcher(
107 DPL::Event::ThreadEventDispatcher &callingThreadDispatcher);
109 static ThreadPool& getInstance();
112 } // WrtDeviceApisCommon
114 #endif // WRTDEVICEAPIS_COMMONS_THREADPOOL_H_