Ken Thomases : libwine: Call the Mac Multi-Processing Services lib from the main thread first.

Alexandre Julliard julliard at winehq.org
Tue Jan 8 13:58:43 CST 2013


Module: wine
Branch: master
Commit: 573436047e93aa911d1ec2a943127df31e61b0a5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=573436047e93aa911d1ec2a943127df31e61b0a5

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Jan  7 14:43:31 2013 -0600

libwine: Call the Mac Multi-Processing Services lib from the main thread first.

---

 libs/wine/Makefile.in |    2 +-
 libs/wine/loader.c    |   22 ++++++++++++++++------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/libs/wine/Makefile.in b/libs/wine/Makefile.in
index ca93d26..a86e73b 100644
--- a/libs/wine/Makefile.in
+++ b/libs/wine/Makefile.in
@@ -1,7 +1,7 @@
 DLLFLAGS  = @DLLFLAGS@
 MODULE    = libwine.$(LIBEXT)
 VERSCRIPT = $(srcdir)/wine.map
-EXTRALIBS = $(LIBPORT) @LIBDL@ @CRTLIBS@ @COREFOUNDATIONLIB@
+EXTRALIBS = $(LIBPORT) @LIBDL@ @CRTLIBS@ @COREFOUNDATIONLIB@ @CORESERVICESLIB@
 DEFS      = -D__WINESRC__ -DWINE_UNICODE_API=""
 
 VERSION   = 1.0
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index df0a6b5..9681381 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -39,21 +39,26 @@
 # include <unistd.h>
 #endif
 
-#define NONAMELESSUNION
-#define NONAMELESSSTRUCT
-#include "windef.h"
-#include "winbase.h"
-#include "wine/library.h"
-
 #ifdef __APPLE__
 #include <crt_externs.h>
 #define environ (*_NSGetEnviron())
 #include <CoreFoundation/CoreFoundation.h>
+#define LoadResource MacLoadResource
+#define GetCurrentThread MacGetCurrentThread
+#include <CoreServices/CoreServices.h>
+#undef LoadResource
+#undef GetCurrentThread
 #include <pthread.h>
 #else
 extern char **environ;
 #endif
 
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+#include "windef.h"
+#include "winbase.h"
+#include "wine/library.h"
+
 /* argc/argv for the Windows application */
 int __wine_main_argc = 0;
 char **__wine_main_argv = NULL;
@@ -756,6 +761,11 @@ static void apple_main_thread( void (*init_func)(void) )
     CFRunLoopSourceContext source_context = { 0 };
     CFRunLoopSourceRef source;
 
+    /* Multi-processing Services can get confused about the main thread if the
+     * first time it's used is on a secondary thread.  Use it here to make sure
+     * that doesn't happen. */
+    MPTaskIsPreemptive(MPCurrentTaskID());
+
     /* Give ourselves the best chance of having the distributed notification
      * center scheduled on this thread's run loop.  In theory, it's scheduled
      * in the first thread to ask for it. */




More information about the wine-cvs mailing list