Remove static initializers as they are not portable under windows.
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 22 Apr 2013 19:45:20 +0000 (15:45 -0400)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 22 Apr 2013 21:20:01 +0000 (17:20 -0400)
mono/io-layer/handles.c
mono/io-layer/io.c
mono/io-layer/io.h
mono/utils/mono-mutex.h

index ee4ff14799c2689392911842c3602b64b4658a8c..6b5cce5ce18046bda1c5b744c8d52daaeab696b0 100644 (file)
@@ -173,7 +173,7 @@ pid_t _wapi_getpid (void)
 }
 
 
-static mono_mutex_t scan_mutex = MONO_MUTEX_INITIALIZER;
+static mono_mutex_t scan_mutex;
 
 static void handle_cleanup (void)
 {
@@ -279,12 +279,15 @@ wapi_init (void)
        if (_wapi_shm_enabled ())
                _wapi_collection_init ();
 #endif
+       _wapi_io_init ();
+       mono_mutex_init (&scan_mutex);
 
        _wapi_global_signal_handle = _wapi_handle_new (WAPI_HANDLE_EVENT, NULL);
 
        _wapi_global_signal_cond = &_WAPI_PRIVATE_HANDLES (GPOINTER_TO_UINT (_wapi_global_signal_handle)).signal_cond;
        _wapi_global_signal_mutex = &_WAPI_PRIVATE_HANDLES (GPOINTER_TO_UINT (_wapi_global_signal_handle)).signal_mutex;
 
+
        /* Using g_atexit here instead of an explicit function call in
         * a cleanup routine lets us cope when a third-party library
         * calls exit (eg if an X client loses the connection to its
index a3e5ad15b56aaa87d2e9c89b1266c7bd1753a363..579c48dd89ed4fbd4cf3af2c99aecb7ac8e90307 100755 (executable)
@@ -2077,7 +2077,7 @@ replace_cleanup:
  * Return value: the handle, or %INVALID_HANDLE_VALUE on error
  */
 
-static mono_mutex_t stdhandle_mutex = MONO_MUTEX_INITIALIZER;
+static mono_mutex_t stdhandle_mutex;
 
 gpointer GetStdHandle(WapiStdHandle stdhandle)
 {
@@ -4256,3 +4256,10 @@ GetVolumeInformation (const gunichar2 *path, gunichar2 *volumename, int volumesi
        return status;
 }
 #endif
+
+
+void
+_wapi_io_init (void)
+{
+       mono_mutex_init (&stdhandle_mutex);
+}
index 6d7c6f575c412a4386d4473f7a7178b4f9305906..e8627764812f3e98632ca244254d96fa7efc823d 100644 (file)
@@ -224,6 +224,9 @@ extern gboolean UnlockFile (gpointer handle, guint32 offset_low,
                            guint32 length_high);
 extern gboolean GetVolumeInformation (const gunichar2 *path, gunichar2 *volumename, int volumesize, int *outserial, int *maxcomp, int *fsflags, gunichar2 *fsbuffer, int fsbuffersize);
 
+
+extern void _wapi_io_init (void);
+
 G_END_DECLS
 
 #endif /* _WAPI_IO_H_ */
index 1de5d9c3aec0efb4b32ed8db4479c2a6b07b22e6..e1ea0110ee5ff8b942ad995f3ac2b3433a7a77f1 100644 (file)
@@ -47,10 +47,6 @@ typedef pthread_mutex_t mono_mutex_t;
 typedef pthread_mutexattr_t mono_mutexattr_t;
 typedef pthread_cond_t mono_cond_t;
 
-#define MONO_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-#define MONO_RECURSIVE_MUTEX_INITIALIZER PTHREAD_RECURSIVE_MUTEX_INITIALIZER
-#define MONO_COND_INITIALIZER PTHREAD_COND_INITIALIZER
-
 #define mono_mutex_init(mutex) pthread_mutex_init (mutex, NULL)
 #define mono_mutex_lock(mutex) pthread_mutex_lock (mutex)
 #define mono_mutex_trylock(mutex) pthread_mutex_trylock (mutex)
@@ -109,7 +105,6 @@ typedef HANDLE mono_cond_t;
 #define mono_cond_broadcast(cond) (!SetEvent(*(cond)))
 #define mono_cond_destroy(cond) CloseHandle(*(cond))
 
-#define MONO_COND_INITIALIZER NULL
 #endif
 
 G_END_DECLS