* Makefile.am: Revert previous linkage against libmono.so, as lupus
authorJonathan Pryor <jpryor@novell.com>
Thu, 15 Apr 2010 17:31:24 +0000 (17:31 -0000)
committerJonathan Pryor <jpryor@novell.com>
Thu, 15 Apr 2010 17:31:24 +0000 (17:31 -0000)
  mentioned that it's unacceptable for MonoPosixHelper to link against
  libmono (e.g. when embedding mono, there might not be a libmono).
* map.h: Flush updated Mono_Unix_UnixSignal_SignalInfo prototype.
* signal.c: Don't use mono_runtime_is_shutting_down(). Instead, change
  Mono_Unix_UnixSignal_WaitAny() to accept a function pointer argument,
  which will return Environment.HasShutdownStarted in managed code (the
  moral equivalent of mono_runtime_is_shutting_down()).  This allows
  us to avoid a libmono dependency w/o lots of rewriting. Fixes #592981.

svn path=/trunk/mono/; revision=155520

support/ChangeLog
support/Makefile.am
support/map.h
support/signal.c

index 3979c66ef2de4e8a7d594f33a65a196e49b185c7..a3e1e6d9c46211dfe6f2fd4b3c4b7d7a2291958e 100644 (file)
@@ -1,3 +1,15 @@
+2010-04-15  Jonathan Pryor  <jpryor@novell.com>
+
+       * Makefile.am: Revert previous linkage against libmono.so, as lupus
+         mentioned that it's unacceptable for MonoPosixHelper to link against
+         libmono (e.g. when embedding mono, there might not be a libmono).
+       * map.h: Flush updated Mono_Unix_UnixSignal_SignalInfo prototype.
+       * signal.c: Don't use mono_runtime_is_shutting_down(). Instead, change
+         Mono_Unix_UnixSignal_WaitAny() to accept a function pointer argument,
+         which will return Environment.HasShutdownStarted in managed code (the 
+         moral equivalent of mono_runtime_is_shutting_down()).  This allows
+         us to avoid a libmono dependency w/o lots of rewriting. Fixes #592981.
+
 2010-04-07 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
        * zlib-helper.c: now that we don't use Z_SYNC_FLUSH, there might be
index a205ad9e6634643a5dfd14d62c1a4ea049e5b027..fd7f1359dd19b63e5a7882a297ae6fc467dc19ab 100644 (file)
@@ -103,18 +103,10 @@ libMonoPosixHelper_la_SOURCES =                   \
        $(Z_SOURCE)                             \
        $(MINIZIP_SOURCE)
 
-if HOST_WIN32
 libMonoPosixHelper_la_LIBADD =                 \
        $(MPH_LIBS)                             \
        $(Z_LIBS)                               \
        $(XATTR_LIB)
-else
-libMonoPosixHelper_la_LIBADD =                 \
-       ../mono/mini/libmono-2.0.la \
-       $(MPH_LIBS)                             \
-       $(Z_LIBS)                               \
-       $(XATTR_LIB)
-endif
 
 # libMonoPosixHelper_la_LDFLAGS = -no-undefined -version-info 1:0:1
 libMonoPosixHelper_la_LDFLAGS = -no-undefined -avoid-version
index d35416392c9f0b2c4cde82ac826d2f51a1e5b7c4..a2e59fd9309929873655afc9a2e39175216f6832 100644 (file)
@@ -1401,6 +1401,7 @@ struct utimbuf;
  * Delegate Declarations
  */
 
+typedef int (*Mono_Posix_RuntimeIsShuttingDown) (void);
 
 /*
  * Structures
@@ -1743,7 +1744,7 @@ int Mono_Posix_Syscall_WTERMSIG (int status);
 int Mono_Posix_ToStatvfs (void* source, struct Mono_Posix_Statvfs* destination);
 void* Mono_Unix_UnixSignal_install (int signum);
 int Mono_Unix_UnixSignal_uninstall (void* info);
-int Mono_Unix_UnixSignal_WaitAny (void** infos, int count, int timeout);
+int Mono_Unix_UnixSignal_WaitAny (void** infos, int count, int timeout, Mono_Posix_RuntimeIsShuttingDown shutting_down);
 int wexitstatus (int status);
 int wifexited (int status);
 int wifsignaled (int status);
index 11e60e1066e666811b567c914535a95cb20bb360..6acb78977e6ce84e68b90fc5823bff2207339620 100644 (file)
@@ -155,7 +155,7 @@ static void release_mutex (pthread_mutex_t *mutex)
 static inline int
 keep_trying (int r)
 {
-       return r == -1 && errno == EINTR && !mono_runtime_is_shutting_down();
+       return r == -1 && errno == EINTR;
 }
 
 static void
@@ -333,7 +333,7 @@ teardown_pipes (signal_info** signals, int count)
 }
 
 static int
-wait_for_any (signal_info** signals, int count, int *currfd, struct pollfd* fd_structs, int timeout)
+wait_for_any (signal_info** signals, int count, int *currfd, struct pollfd* fd_structs, int timeout, Mono_Posix_RuntimeIsShuttingDown shutting_down)
 {
        int r, idx;
        do {
@@ -345,7 +345,7 @@ wait_for_any (signal_info** signals, int count, int *currfd, struct pollfd* fd_s
                        ptv = &tv;
                }
                r = poll (fd_structs, count, timeout);
-       } while (keep_trying (r));
+       } while (keep_trying (r) && !shutting_down ());
 
        idx = -1;
        if (r == 0)
@@ -359,7 +359,7 @@ wait_for_any (signal_info** signals, int count, int *currfd, struct pollfd* fd_s
                                char c;
                                do {
                                        r = read (h->read_fd, &c, 1);
-                               } while (keep_trying (r));
+                               } while (keep_trying (r) && !shutting_down ());
                                if (idx == -1)
                                        idx = i;
                        }
@@ -375,7 +375,7 @@ wait_for_any (signal_info** signals, int count, int *currfd, struct pollfd* fd_s
  *          index into _signals array of signal that was generated on success
  */
 int
-Mono_Unix_UnixSignal_WaitAny (void** _signals, int count, int timeout /* milliseconds */)
+Mono_Unix_UnixSignal_WaitAny (void** _signals, int count, int timeout /* milliseconds */, Mono_Posix_RuntimeIsShuttingDown shutting_down)
 {
        int r;
        int currfd = 0;
@@ -394,7 +394,7 @@ Mono_Unix_UnixSignal_WaitAny (void** _signals, int count, int timeout /* millise
        release_mutex (&signals_mutex);
 
        if (r == 0) {
-               r = wait_for_any (signals, count, &currfd, &fd_structs[0], timeout);
+               r = wait_for_any (signals, count, &currfd, &fd_structs[0], timeout, shutting_down);
        }
 
        if (acquire_mutex (&signals_mutex) == -1)