From 979040e7b321baa2c61ca29aa46596dbe88a1255 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Tue, 27 Jun 2017 13:47:58 +0000 Subject: [PATCH] fixed the io semaphore handling error when DEVPOLL is activated --- moo/kernel/X11.moo | 9 ++++++++- moo/lib/main.c | 3 +++ moo/lib/moo.c | 2 +- moo/mod/Makefile.am | 2 +- moo/mod/Makefile.in | 15 +++------------ 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/moo/kernel/X11.moo b/moo/kernel/X11.moo index cc4905b..5a60497 100644 --- a/moo/kernel/X11.moo +++ b/moo/kernel/X11.moo @@ -575,26 +575,33 @@ extend X11 class MyObject(Object) { - var disp1, shell1, shell2. + var disp1, disp2, shell1, shell2, shell3. method main1 { self.disp1 := X11 new. + self.disp2 := X11 new. shell1 := (X11.Shell new title: 'Shell 1'). shell2 := (X11.Shell new title: 'Shell 2'). + shell3 := (X11.Shell new title: 'Shell 3'). + shell1 x: 10; y: 20; width: 100; height: 100. shell2 x: 200; y: 200; width: 200; height: 200. + shell3 x: 500; y: 200; width: 200; height: 200. self.disp1 addShell: shell1. self.disp1 addShell: shell2. + self.disp2 addShell: shell3. self.shell1 add: (X11.Label new text: 'xxxxxxxx'). self.shell1 realize. self.shell2 realize. + self.shell3 realize. self.disp1 enterEventLoop. ## this is not a blocking call. it spawns another process. + self.disp2 enterEventLoop. } method(#class) main diff --git a/moo/lib/main.c b/moo/lib/main.c index 376f4b6..dd94835 100644 --- a/moo/lib/main.c +++ b/moo/lib/main.c @@ -790,6 +790,8 @@ static int _add_poll_fd (moo_t* moo, int fd, int event_mask, moo_oow_t event_dat MOO_DEBUG2 (moo, "Cannot add file descriptor %d to devpoll - %hs\n", fd, strerror(errno)); return -1; } + + xtn->epd.ptr[fd] = event_data; return 0; #elif defined(USE_EPOLL) @@ -838,6 +840,7 @@ static int _add_poll_fd (moo_t* moo, int fd, int event_mask, moo_oow_t event_dat xtn->ev.reg.ptr[xtn->ev.reg.len].revents = 0; xtn->ev.reg.len++; + xtn->epd.ptr[fd] = event_data; return 0; #else diff --git a/moo/lib/moo.c b/moo/lib/moo.c index 60fa7e4..33c5fcb 100644 --- a/moo/lib/moo.c +++ b/moo/lib/moo.c @@ -404,7 +404,7 @@ static_modtab[] = { "stdio", moo_mod_stdio }, #if defined(MOO_ENABLE_MOD_X11) { "x11", moo_mod_x11 }, - { "x11.win", moo_mod_x11_win }, + /*{ "x11.win", moo_mod_x11_win },*/ #endif }; #endif diff --git a/moo/mod/Makefile.am b/moo/mod/Makefile.am index 04b87d8..15ddc41 100644 --- a/moo/mod/Makefile.am +++ b/moo/mod/Makefile.am @@ -70,7 +70,7 @@ libmoo_stdio_la_LDFLAGS = $(LDFLAGS_COMMON) libmoo_stdio_la_LIBADD = $(LIBADD_COMMON) if ENABLE_MOD_X11 -libmoo_x11_la_SOURCES = x11.c x11-win.c _x11.h +libmoo_x11_la_SOURCES = x11.c _x11.h libmoo_x11_la_CPPFLAGS = $(CPPFLAGS_COMMON) libmoo_x11_la_LDFLAGS = $(LDFLAGS_COMMON) libmoo_x11_la_LIBADD = $(LIBADD_COMMON) -lX11 diff --git a/moo/mod/Makefile.in b/moo/mod/Makefile.in index 7859ede..2bd3cbe 100644 --- a/moo/mod/Makefile.in +++ b/moo/mod/Makefile.in @@ -182,9 +182,8 @@ libmoo_stdio_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ @ENABLE_STATIC_MODULE_TRUE@am_libmoo_stdio_la_rpath = @ENABLE_MOD_X11_TRUE@libmoo_x11_la_DEPENDENCIES = \ @ENABLE_MOD_X11_TRUE@ $(am__DEPENDENCIES_1) -am__libmoo_x11_la_SOURCES_DIST = x11.c x11-win.c _x11.h -@ENABLE_MOD_X11_TRUE@am_libmoo_x11_la_OBJECTS = libmoo_x11_la-x11.lo \ -@ENABLE_MOD_X11_TRUE@ libmoo_x11_la-x11-win.lo +am__libmoo_x11_la_SOURCES_DIST = x11.c _x11.h +@ENABLE_MOD_X11_TRUE@am_libmoo_x11_la_OBJECTS = libmoo_x11_la-x11.lo libmoo_x11_la_OBJECTS = $(am_libmoo_x11_la_OBJECTS) libmoo_x11_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -455,7 +454,7 @@ libmoo_stdio_la_SOURCES = stdio.c _stdio.h libmoo_stdio_la_CPPFLAGS = $(CPPFLAGS_COMMON) libmoo_stdio_la_LDFLAGS = $(LDFLAGS_COMMON) libmoo_stdio_la_LIBADD = $(LIBADD_COMMON) -@ENABLE_MOD_X11_TRUE@libmoo_x11_la_SOURCES = x11.c x11-win.c _x11.h +@ENABLE_MOD_X11_TRUE@libmoo_x11_la_SOURCES = x11.c _x11.h @ENABLE_MOD_X11_TRUE@libmoo_x11_la_CPPFLAGS = $(CPPFLAGS_COMMON) @ENABLE_MOD_X11_TRUE@libmoo_x11_la_LDFLAGS = $(LDFLAGS_COMMON) @ENABLE_MOD_X11_TRUE@libmoo_x11_la_LIBADD = $(LIBADD_COMMON) -lX11 @@ -560,7 +559,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_console_la-console.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_ffi_la-ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_stdio_la-stdio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_x11_la-x11-win.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_x11_la-x11.Plo@am__quote@ .c.o: @@ -615,13 +613,6 @@ libmoo_x11_la-x11.lo: x11.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_x11_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmoo_x11_la-x11.lo `test -f 'x11.c' || echo '$(srcdir)/'`x11.c -libmoo_x11_la-x11-win.lo: x11-win.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_x11_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmoo_x11_la-x11-win.lo -MD -MP -MF $(DEPDIR)/libmoo_x11_la-x11-win.Tpo -c -o libmoo_x11_la-x11-win.lo `test -f 'x11-win.c' || echo '$(srcdir)/'`x11-win.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmoo_x11_la-x11-win.Tpo $(DEPDIR)/libmoo_x11_la-x11-win.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='x11-win.c' object='libmoo_x11_la-x11-win.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_x11_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmoo_x11_la-x11-win.lo `test -f 'x11-win.c' || echo '$(srcdir)/'`x11-win.c - mostlyclean-libtool: -rm -f *.lo