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 {
65 PLUGIN_TEMPLETE_THREAD,
81 class ThreadPool : private DPL::Noncopyable
84 typedef std::map<ThreadEnum::Enumeration, DPL::Thread*> ThreadHandleMap;
85 ThreadHandleMap m_threadHandlers;
86 DPL::Mutex m_threadHandlersMutex;
88 DPL::Thread *getThreadHandleCreateIfNotExists(ThreadEnum::Enumeration type);
90 //DPL::MainEventDispatcher m_mainEventDispatcher;
97 * @throws: WrtDeviceApis::Commons::InvalidArgumentException
99 DPL::Thread * getThreadRef(ThreadEnum::Enumeration type);
102 * Get proper dispatcher for current calling thread
104 DPL::Event::AbstractEventDispatcher *getDispatcher(
105 DPL::Event::ThreadEventDispatcher &callingThreadDispatcher);
107 static ThreadPool& getInstance();
111 } // WrtDeviceApisCommon
113 #endif // WRTDEVICEAPIS_COMMONS_THREADPOOL_H_