summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore/Ecore_Common.h8
-rw-r--r--src/lib/ecore/ecore_main.c47
-rw-r--r--src/lib/ecore/ecore_private.h1
3 files changed, 13 insertions, 43 deletions
diff --git a/src/lib/ecore/Ecore_Common.h b/src/lib/ecore/Ecore_Common.h
index de515c57ed..9b777d7364 100644
--- a/src/lib/ecore/Ecore_Common.h
+++ b/src/lib/ecore/Ecore_Common.h
@@ -1388,13 +1388,7 @@ enum _Ecore_Fd_Handler_Flags
1388{ 1388{
1389 ECORE_FD_READ = 1, /**< Fd Read mask */ 1389 ECORE_FD_READ = 1, /**< Fd Read mask */
1390 ECORE_FD_WRITE = 2, /**< Fd Write mask */ 1390 ECORE_FD_WRITE = 2, /**< Fd Write mask */
1391 ECORE_FD_ERROR = 4, /**< Fd Error mask */ 1391 ECORE_FD_ERROR = 4 /**< Fd Error mask */
1392 /* ECORE_FD_ALWAYS is intended to fix a problem with wayland
1393 * and threads. It causes the fd handler to be called
1394 * in any state, so wayland libs can call read_cancel
1395 * if nothing is available to read. Everyone else should
1396 * stay away. */
1397 ECORE_FD_ALWAYS = 8, /**< Fd Always mask - DO NOT USE! */
1398}; 1392};
1399typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags; 1393typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags;
1400 1394
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index 9c30ac51db..2c1a2ef868 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -248,7 +248,7 @@ _ecore_try_add_to_call_list(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd, Ecore_Fd_Han
248 DBG("next_ready"); 248 DBG("next_ready");
249 return; 249 return;
250 } 250 }
251 if (fdh->read_active || fdh->write_active || fdh->error_active || (fdh->flags & ECORE_FD_ALWAYS)) 251 if (fdh->read_active || fdh->write_active || fdh->error_active)
252 { 252 {
253 DBG("added"); 253 DBG("added");
254 // make sure next_ready is non-null by pointing to ourselves 254 // make sure next_ready is non-null by pointing to ourselves
@@ -583,10 +583,6 @@ _ecore_main_fdh_epoll_mark_active(Eo *obj, Efl_Loop_Data *pd)
583 fdh->write_active = EINA_TRUE; 583 fdh->write_active = EINA_TRUE;
584 fdh->error_active = EINA_TRUE; 584 fdh->error_active = EINA_TRUE;
585 } 585 }
586 /* We'll add this one anyway outside this function,
587 don't want it twice */
588 if (fdh->flags & ECORE_FD_ALWAYS)
589 continue;
590 586
591 _ecore_try_add_to_call_list(obj, pd, fdh); 587 _ecore_try_add_to_call_list(obj, pd, fdh);
592 } 588 }
@@ -1361,9 +1357,6 @@ _ecore_main_fd_handler_add(Eo *obj,
1361 if (is_file) 1357 if (is_file)
1362 pd->file_fd_handlers = eina_list_append 1358 pd->file_fd_handlers = eina_list_append
1363 (pd->file_fd_handlers, fdh); 1359 (pd->file_fd_handlers, fdh);
1364 if (fdh->flags & ECORE_FD_ALWAYS)
1365 pd->always_fd_handlers = eina_list_append
1366 (pd->always_fd_handlers, fdh);
1367 pd->fd_handlers = (Ecore_Fd_Handler *) 1360 pd->fd_handlers = (Ecore_Fd_Handler *)
1368 eina_inlist_append(EINA_INLIST_GET(pd->fd_handlers), 1361 eina_inlist_append(EINA_INLIST_GET(pd->fd_handlers),
1369 EINA_INLIST_GET(fdh)); 1362 EINA_INLIST_GET(fdh));
@@ -1671,9 +1664,6 @@ _ecore_main_content_clear(Eo *obj, Efl_Loop_Data *pd)
1671 if (pd->file_fd_handlers) 1664 if (pd->file_fd_handlers)
1672 pd->file_fd_handlers = 1665 pd->file_fd_handlers =
1673 eina_list_free(pd->file_fd_handlers); 1666 eina_list_free(pd->file_fd_handlers);
1674 if (pd->always_fd_handlers)
1675 pd->always_fd_handlers =
1676 eina_list_free(pd->always_fd_handlers);
1677 if (pd->fd_handlers_to_delete) 1667 if (pd->fd_handlers_to_delete)
1678 pd->fd_handlers_to_delete = 1668 pd->fd_handlers_to_delete =
1679 eina_list_free(pd->fd_handlers_to_delete); 1669 eina_list_free(pd->fd_handlers_to_delete);
@@ -1751,7 +1741,7 @@ _ecore_main_select(Eo *obj, Efl_Loop_Data *pd, double timeout)
1751 fd_set rfds, wfds, exfds; 1741 fd_set rfds, wfds, exfds;
1752 Ecore_Fd_Handler *fdh; 1742 Ecore_Fd_Handler *fdh;
1753 Eina_List *l; 1743 Eina_List *l;
1754 int max_fd, ret, outval; 1744 int max_fd, ret;
1755#ifndef _WIN32 1745#ifndef _WIN32
1756 int err_no; 1746 int err_no;
1757#endif 1747#endif
@@ -1795,17 +1785,17 @@ _ecore_main_select(Eo *obj, Efl_Loop_Data *pd, double timeout)
1795 { 1785 {
1796 if (!fdh->delete_me) 1786 if (!fdh->delete_me)
1797 { 1787 {
1798 if ((fdh->flags & ECORE_FD_READ) || (fdh->flags & ECORE_FD_ALWAYS)) 1788 if (fdh->flags & ECORE_FD_READ)
1799 { 1789 {
1800 FD_SET(fdh->fd, &rfds); 1790 FD_SET(fdh->fd, &rfds);
1801 if (fdh->fd > max_fd) max_fd = fdh->fd; 1791 if (fdh->fd > max_fd) max_fd = fdh->fd;
1802 } 1792 }
1803 if ((fdh->flags & ECORE_FD_WRITE) || (fdh->flags & ECORE_FD_ALWAYS)) 1793 if (fdh->flags & ECORE_FD_WRITE)
1804 { 1794 {
1805 FD_SET(fdh->fd, &wfds); 1795 FD_SET(fdh->fd, &wfds);
1806 if (fdh->fd > max_fd) max_fd = fdh->fd; 1796 if (fdh->fd > max_fd) max_fd = fdh->fd;
1807 } 1797 }
1808 if ((fdh->flags & ECORE_FD_ERROR) || (fdh->flags & ECORE_FD_ALWAYS)) 1798 if (fdh->flags & ECORE_FD_ERROR)
1809 { 1799 {
1810 FD_SET(fdh->fd, &exfds); 1800 FD_SET(fdh->fd, &exfds);
1811 if (fdh->fd > max_fd) max_fd = fdh->fd; 1801 if (fdh->fd > max_fd) max_fd = fdh->fd;
@@ -1825,17 +1815,17 @@ _ecore_main_select(Eo *obj, Efl_Loop_Data *pd, double timeout)
1825 { 1815 {
1826 if (!fdh->delete_me) 1816 if (!fdh->delete_me)
1827 { 1817 {
1828 if ((fdh->flags & ECORE_FD_READ) || (fdh->flags & ECORE_FD_ALWAYS)) 1818 if (fdh->flags & ECORE_FD_READ)
1829 { 1819 {
1830 FD_SET(fdh->fd, &rfds); 1820 FD_SET(fdh->fd, &rfds);
1831 if (fdh->fd > max_fd) max_fd = fdh->fd; 1821 if (fdh->fd > max_fd) max_fd = fdh->fd;
1832 } 1822 }
1833 if ((fdh->flags & ECORE_FD_WRITE) || (fdh->flags & ECORE_FD_ALWAYS)) 1823 if (fdh->flags & ECORE_FD_WRITE)
1834 { 1824 {
1835 FD_SET(fdh->fd, &wfds); 1825 FD_SET(fdh->fd, &wfds);
1836 if (fdh->fd > max_fd) max_fd = fdh->fd; 1826 if (fdh->fd > max_fd) max_fd = fdh->fd;
1837 } 1827 }
1838 if ((fdh->flags & ECORE_FD_ERROR) || (fdh->flags & ECORE_FD_ALWAYS)) 1828 if (fdh->flags & ECORE_FD_ERROR)
1839 { 1829 {
1840 FD_SET(fdh->fd, &exfds); 1830 FD_SET(fdh->fd, &exfds);
1841 if (fdh->fd > max_fd) max_fd = fdh->fd; 1831 if (fdh->fd > max_fd) max_fd = fdh->fd;
@@ -1861,11 +1851,7 @@ _ecore_main_select(Eo *obj, Efl_Loop_Data *pd, double timeout)
1861 if (ret < 0) 1851 if (ret < 0)
1862 { 1852 {
1863#ifndef _WIN32 1853#ifndef _WIN32
1864 if (err_no == EINTR) 1854 if (err_no == EINTR) return -1;
1865 {
1866 outval = -1;
1867 goto BAIL;
1868 }
1869 else if (err_no == EBADF) _ecore_main_fd_handlers_bads_rem(obj, pd); 1855 else if (err_no == EBADF) _ecore_main_fd_handlers_bads_rem(obj, pd);
1870#endif 1856#endif
1871 } 1857 }
@@ -1908,15 +1894,9 @@ _ecore_main_select(Eo *obj, Efl_Loop_Data *pd, double timeout)
1908#ifdef _WIN32 1894#ifdef _WIN32
1909 _ecore_main_win32_handlers_cleanup(obj, pd); 1895 _ecore_main_win32_handlers_cleanup(obj, pd);
1910#endif 1896#endif
1911 outval = 1; 1897 return 1;
1912 goto BAIL;
1913 } 1898 }
1914 outval = 0; 1899 return 0;
1915BAIL:
1916 EINA_LIST_FOREACH(pd->always_fd_handlers, l, fdh)
1917 _ecore_try_add_to_call_list(obj, pd, fdh);
1918
1919 return outval;
1920} 1900}
1921 1901
1922#endif 1902#endif
@@ -2037,8 +2017,6 @@ _ecore_main_fd_handlers_cleanup(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd)
2037 EINA_INLIST_GET(fdh)); 2017 EINA_INLIST_GET(fdh));
2038 if (fdh->file) 2018 if (fdh->file)
2039 pd->file_fd_handlers = eina_list_remove(pd->file_fd_handlers, fdh); 2019 pd->file_fd_handlers = eina_list_remove(pd->file_fd_handlers, fdh);
2040 if (fdh->flags & ECORE_FD_ALWAYS)
2041 pd->always_fd_handlers = eina_list_remove(pd->always_fd_handlers, fdh);
2042 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE); 2020 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
2043 ecore_fd_handler_mp_free(fdh); 2021 ecore_fd_handler_mp_free(fdh);
2044 pd->fd_handlers_to_delete = eina_list_remove_list 2022 pd->fd_handlers_to_delete = eina_list_remove_list
@@ -2096,8 +2074,7 @@ _ecore_main_fd_handlers_call(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd)
2096 { 2074 {
2097 if ((fdh->read_active) || 2075 if ((fdh->read_active) ||
2098 (fdh->write_active) || 2076 (fdh->write_active) ||
2099 (fdh->error_active) || 2077 (fdh->error_active))
2100 (fdh->flags & ECORE_FD_ALWAYS))
2101 { 2078 {
2102 fdh->references++; 2079 fdh->references++;
2103 if (!_ecore_call_fd_cb(fdh->func, fdh->data, fdh)) 2080 if (!_ecore_call_fd_cb(fdh->func, fdh->data, fdh))
diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h
index 2cb3b36d27..4e980d9123 100644
--- a/src/lib/ecore/ecore_private.h
+++ b/src/lib/ecore/ecore_private.h
@@ -138,7 +138,6 @@ struct _Efl_Loop_Data
138 Ecore_Fd_Handler *fd_handlers; 138 Ecore_Fd_Handler *fd_handlers;
139 Eina_List *fd_handlers_with_prep; 139 Eina_List *fd_handlers_with_prep;
140 Eina_List *file_fd_handlers; 140 Eina_List *file_fd_handlers;
141 Eina_List *always_fd_handlers;
142 Eina_List *fd_handlers_with_buffer; 141 Eina_List *fd_handlers_with_buffer;
143 Eina_List *fd_handlers_to_delete; 142 Eina_List *fd_handlers_to_delete;
144 Ecore_Fd_Handler *fd_handlers_to_call; 143 Ecore_Fd_Handler *fd_handlers_to_call;