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.
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief This file is the implementation file of main for EFL
25 #include <dpl/waitable_handle_watch_support.h>
26 #include <dpl/exception.h>
27 #include <dpl/singleton.h>
28 #include <dpl/workaround.h>
29 #include <dpl/framework_efl.h>
35 : public WaitableHandleWatchSupport
41 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
42 DECLARE_EXCEPTION_TYPE(Base, CreateFailed)
46 Ecore_Fd_Handler *m_invokerHandler;
48 static Eina_Bool StaticDispatchInvoker(void *data, Ecore_Fd_Handler *fd_handler);
49 static Eina_Bool StaticDispatchReadWatcher(void *data, Ecore_Fd_Handler *fd_handler);
50 static Eina_Bool StaticDispatchWriteWatcher(void *data, Ecore_Fd_Handler *fd_handler);
52 typedef std::list<Ecore_Fd_Handler *> EcoreFdHandlerList;
54 EcoreFdHandlerList m_readWatchersList;
55 EcoreFdHandlerList m_writeWatchersList;
57 void DispatchInvoker();
58 void DispatchReadWatcher(WaitableHandle waitableHandle);
59 void DispatchWriteWatcher(WaitableHandle waitableHandle);
61 void ReloadWatchList();
63 // WaitableHandleWatchSupport
64 virtual Thread *GetInvokerThread();
65 virtual void HandleDirectInvoker();
67 #ifdef DPL_ENABLE_GLIB_LOOP_INTEGRATION_WORKAROUND
68 // GLIB loop intergration workaround
69 typedef int (*EcoreSelectType)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
70 EcoreSelectType m_oldEcoreSelect;
72 static int EcoreSelectInterceptor(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
73 #endif // DPL_ENABLE_GLIB_LOOP_INTEGRATION_WORKAROUND
83 typedef Singleton<Main> MainSingleton;