summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore/ecore_main.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-12-03 03:39:07 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-12-03 03:39:07 +0000
commit54a2db004437fc6f86718289cd5cdea66ff55ad3 (patch)
tree0b1bfe74b61520570f3d38b11654fed03d45ac97 /legacy/ecore/src/lib/ecore/ecore_main.c
parentccf4af02aa2a341c0a7b121d1fa1417143fc1d65 (diff)
mempools++
SVN revision: 65833
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore/ecore_main.c50
1 files changed, 7 insertions, 43 deletions
diff --git a/legacy/ecore/src/lib/ecore/ecore_main.c b/legacy/ecore/src/lib/ecore/ecore_main.c
index aacf991fd7..23e670c3bd 100644
--- a/legacy/ecore/src/lib/ecore/ecore_main.c
+++ b/legacy/ecore/src/lib/ecore/ecore_main.c
@@ -145,42 +145,6 @@ timerfd_settime(int fd __UNUSED__,
145 145
146#define NS_PER_SEC (1000.0 * 1000.0 * 1000.0) 146#define NS_PER_SEC (1000.0 * 1000.0 * 1000.0)
147 147
148struct _Ecore_Fd_Handler
149{
150 EINA_INLIST;
151 ECORE_MAGIC;
152 Ecore_Fd_Handler *next_ready;
153 int fd;
154 Ecore_Fd_Handler_Flags flags;
155 Ecore_Fd_Cb func;
156 void *data;
157 Ecore_Fd_Cb buf_func;
158 void *buf_data;
159 Ecore_Fd_Prep_Cb prep_func;
160 void *prep_data;
161 int references;
162 Eina_Bool read_active : 1;
163 Eina_Bool write_active : 1;
164 Eina_Bool error_active : 1;
165 Eina_Bool delete_me : 1;
166#if defined(USE_G_MAIN_LOOP)
167 GPollFD gfd;
168#endif
169};
170
171#ifdef _WIN32
172struct _Ecore_Win32_Handler
173{
174 EINA_INLIST;
175 ECORE_MAGIC;
176 HANDLE h;
177 Ecore_Win32_Handle_Cb func;
178 void *data;
179 int references;
180 Eina_Bool delete_me : 1;
181};
182#endif
183
184#ifndef USE_G_MAIN_LOOP 148#ifndef USE_G_MAIN_LOOP
185static int _ecore_main_select(double timeout); 149static int _ecore_main_select(double timeout);
186#endif 150#endif
@@ -990,7 +954,7 @@ ecore_main_fd_handler_add(int fd,
990 954
991 if ((fd < 0) || (flags == 0) || (!func)) goto unlock; 955 if ((fd < 0) || (flags == 0) || (!func)) goto unlock;
992 956
993 fdh = calloc(1, sizeof(Ecore_Fd_Handler)); 957 fdh = ecore_fd_handler_calloc(1);
994 if (!fdh) goto unlock; 958 if (!fdh) goto unlock;
995 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_FD_HANDLER); 959 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_FD_HANDLER);
996 fdh->next_ready = NULL; 960 fdh->next_ready = NULL;
@@ -1000,7 +964,7 @@ ecore_main_fd_handler_add(int fd,
1000 { 964 {
1001 int err = errno; 965 int err = errno;
1002 ERR("Failed to add poll on fd %d (errno = %d: %s)!", fd, err, strerror(err)); 966 ERR("Failed to add poll on fd %d (errno = %d: %s)!", fd, err, strerror(err));
1003 free(fdh); 967 ecore_fd_handler_mp_free(fdh);
1004 fdh = NULL; 968 fdh = NULL;
1005 goto unlock; 969 goto unlock;
1006 } 970 }
@@ -1033,7 +997,7 @@ ecore_main_win32_handler_add(void *h,
1033 997
1034 if (!h || !func) return NULL; 998 if (!h || !func) return NULL;
1035 999
1036 wh = calloc(1, sizeof(Ecore_Win32_Handler)); 1000 wh = ecore_win32_handler_calloc(1);
1037 if (!wh) return NULL; 1001 if (!wh) return NULL;
1038 ECORE_MAGIC_SET(wh, ECORE_MAGIC_WIN32_HANDLER); 1002 ECORE_MAGIC_SET(wh, ECORE_MAGIC_WIN32_HANDLER);
1039 wh->h = (HANDLE)h; 1003 wh->h = (HANDLE)h;
@@ -1263,7 +1227,7 @@ _ecore_main_shutdown(void)
1263 fd_handlers = (Ecore_Fd_Handler *)eina_inlist_remove(EINA_INLIST_GET(fd_handlers), 1227 fd_handlers = (Ecore_Fd_Handler *)eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
1264 EINA_INLIST_GET(fdh)); 1228 EINA_INLIST_GET(fdh));
1265 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE); 1229 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
1266 free(fdh); 1230 ecore_fd_handler_mp_free(fdh);
1267 } 1231 }
1268 if (fd_handlers_with_buffer) 1232 if (fd_handlers_with_buffer)
1269 fd_handlers_with_buffer = eina_list_free(fd_handlers_with_buffer); 1233 fd_handlers_with_buffer = eina_list_free(fd_handlers_with_buffer);
@@ -1286,7 +1250,7 @@ _ecore_main_shutdown(void)
1286 win32_handlers = (Ecore_Win32_Handler *)eina_inlist_remove(EINA_INLIST_GET(win32_handlers), 1250 win32_handlers = (Ecore_Win32_Handler *)eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
1287 EINA_INLIST_GET(wh)); 1251 EINA_INLIST_GET(wh));
1288 ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE); 1252 ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
1289 free(wh); 1253 ecore_win32_handler_mp_free(wh);
1290 } 1254 }
1291 win32_handlers_delete_me = EINA_FALSE; 1255 win32_handlers_delete_me = EINA_FALSE;
1292 win32_handler_current = NULL; 1256 win32_handler_current = NULL;
@@ -1527,7 +1491,7 @@ _ecore_main_fd_handlers_cleanup(void)
1527 fd_handlers = (Ecore_Fd_Handler *) 1491 fd_handlers = (Ecore_Fd_Handler *)
1528 eina_inlist_remove(EINA_INLIST_GET(fd_handlers), EINA_INLIST_GET(fdh)); 1492 eina_inlist_remove(EINA_INLIST_GET(fd_handlers), EINA_INLIST_GET(fdh));
1529 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE); 1493 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
1530 free(fdh); 1494 ecore_fd_handler_mp_free(fdh);
1531 fd_handlers_to_delete = eina_list_remove_list(fd_handlers_to_delete, l); 1495 fd_handlers_to_delete = eina_list_remove_list(fd_handlers_to_delete, l);
1532 } 1496 }
1533} 1497}
@@ -1558,7 +1522,7 @@ _ecore_main_win32_handlers_cleanup(void)
1558 eina_inlist_remove(EINA_INLIST_GET(win32_handlers), 1522 eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
1559 EINA_INLIST_GET(wh)); 1523 EINA_INLIST_GET(wh));
1560 ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE); 1524 ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
1561 free(wh); 1525 ecore_win32_handler_mp_free(wh);
1562 } 1526 }
1563 } 1527 }
1564 if (!deleted_in_use) win32_handlers_delete_me = EINA_FALSE; 1528 if (!deleted_in_use) win32_handlers_delete_me = EINA_FALSE;