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>
34 public WaitableHandleWatchSupport
40 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
41 DECLARE_EXCEPTION_TYPE(Base, CreateFailed)
45 Ecore_Fd_Handler *m_invokerHandler;
47 static Eina_Bool StaticDispatchInvoker(void *data,
48 Ecore_Fd_Handler *fd_handler);
49 static Eina_Bool StaticDispatchReadWatcher(void *data,
50 Ecore_Fd_Handler *fd_handler);
51 static Eina_Bool StaticDispatchWriteWatcher(void *data,
52 Ecore_Fd_Handler *fd_handler);
54 typedef std::list<Ecore_Fd_Handler *> EcoreFdHandlerList;
56 EcoreFdHandlerList m_readWatchersList;
57 EcoreFdHandlerList m_writeWatchersList;
59 void DispatchInvoker();
60 void DispatchReadWatcher(WaitableHandle waitableHandle);
61 void DispatchWriteWatcher(WaitableHandle waitableHandle);
63 void ReloadWatchList();
65 // WaitableHandleWatchSupport
66 virtual Thread *GetInvokerThread();
67 virtual void HandleDirectInvoker();
69 #ifdef DPL_ENABLE_GLIB_LOOP_INTEGRATION_WORKAROUND
70 // GLIB loop intergration workaround
71 typedef int (*EcoreSelectType)(int nfds, fd_set *readfds, fd_set *writefds,
72 fd_set *exceptfds, struct timeval *timeout);
73 EcoreSelectType m_oldEcoreSelect;
75 static int EcoreSelectInterceptor(int nfds,
79 struct timeval *timeout);
80 #endif // DPL_ENABLE_GLIB_LOOP_INTEGRATION_WORKAROUND
90 typedef Singleton<Main> MainSingleton;