summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore/ecore_main.c
diff options
context:
space:
mode:
authorMike McCormack <mj.mccormack@samsung.com>2011-08-12 05:22:07 +0000
committerMike McCormack <mikem@ring3k.org>2011-08-12 05:22:07 +0000
commit01e790ed407a71756fffa369e687d079a0579bf4 (patch)
treedeaecc1c40d3cfb1fae65ab2aebb9ee575107df1 /legacy/ecore/src/lib/ecore/ecore_main.c
parent25b0ab9ca78ec2898c88de753e0396657f238f89 (diff)
ecore: Create a lockless ecore_main_fd_handler_del
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> SVN revision: 62374
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore/ecore_main.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/legacy/ecore/src/lib/ecore/ecore_main.c b/legacy/ecore/src/lib/ecore/ecore_main.c
index cdca336fcc..df41acf4f7 100644
--- a/legacy/ecore/src/lib/ecore/ecore_main.c
+++ b/legacy/ecore/src/lib/ecore/ecore_main.c
@@ -789,6 +789,25 @@ _ecore_main_loop_shutdown(void)
789 } 789 }
790} 790}
791 791
792void *
793_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
794{
795 if (fd_handler->delete_me)
796 {
797 ERR("fdh %p deleted twice", fd_handler);
798 return NULL;
799 }
800
801 _ecore_main_fdh_poll_del(fd_handler);
802 fd_handler->delete_me = EINA_TRUE;
803 fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fd_handler);
804 if (fd_handler->prep_func && fd_handlers_with_prep)
805 fd_handlers_with_prep = eina_list_remove(fd_handlers_with_prep, fd_handler);
806 if (fd_handler->buf_func && fd_handlers_with_buffer)
807 fd_handlers_with_buffer = eina_list_remove(fd_handlers_with_buffer, fd_handler);
808 return fd_handler->data;
809}
810
792/** 811/**
793 * @addtogroup Ecore_Main_Loop_Group 812 * @addtogroup Ecore_Main_Loop_Group
794 * 813 *
@@ -998,6 +1017,7 @@ ecore_main_win32_handler_add(void *h __UNUSED__, Ecore_Win32_Handle_Cb func __UN
998} 1017}
999#endif 1018#endif
1000 1019
1020
1001/** 1021/**
1002 * Deletes the given FD handler. 1022 * Deletes the given FD handler.
1003 * @param fd_handler The given FD handler. 1023 * @param fd_handler The given FD handler.
@@ -1023,20 +1043,7 @@ ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
1023 "ecore_main_fd_handler_del"); 1043 "ecore_main_fd_handler_del");
1024 goto unlock; 1044 goto unlock;
1025 } 1045 }
1026 if (fd_handler->delete_me) 1046 ret = _ecore_main_fd_handler_del(fd_handler);
1027 {
1028 ERR("fdh %p deleted twice", fd_handler);
1029 goto unlock;
1030 }
1031
1032 _ecore_main_fdh_poll_del(fd_handler);
1033 fd_handler->delete_me = EINA_TRUE;
1034 fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fd_handler);
1035 if (fd_handler->prep_func && fd_handlers_with_prep)
1036 fd_handlers_with_prep = eina_list_remove(fd_handlers_with_prep, fd_handler);
1037 if (fd_handler->buf_func && fd_handlers_with_buffer)
1038 fd_handlers_with_buffer = eina_list_remove(fd_handlers_with_buffer, fd_handler);
1039 ret = fd_handler->data;
1040unlock: 1047unlock:
1041 _ecore_unlock(); 1048 _ecore_unlock();
1042 return ret; 1049 return ret;