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_
28 #include <dpl/thread.h>
29 #include <dpl/event/main_event_dispatcher.h>
30 #include <dpl/event/thread_event_dispatcher.h>
31 #include <dpl/event/event_support.h>
33 namespace WrtDeviceApis {
64 PLUGIN_TEMPLETE_THREAD,
83 class ThreadPool : private DPL::Noncopyable
86 typedef std::map<ThreadEnum::Enumeration, DPL::Thread*> ThreadHandleMap;
87 ThreadHandleMap m_threadHandlers;
88 std::mutex m_threadHandlersMutex;
90 DPL::Thread *getThreadHandleCreateIfNotExists(ThreadEnum::Enumeration type);
92 //DPL::MainEventDispatcher m_mainEventDispatcher;
100 * @throws: WrtDeviceApis::Commons::InvalidArgumentException
102 DPL::Thread * getThreadRef(ThreadEnum::Enumeration type);
105 * Get proper dispatcher for current calling thread
107 DPL::Event::AbstractEventDispatcher *getDispatcher(
108 DPL::Event::ThreadEventDispatcher &callingThreadDispatcher);
110 static ThreadPool& getInstance();
113 } // WrtDeviceApisCommon
115 #endif // WRTDEVICEAPIS_COMMONS_THREADPOOL_H_