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

This commit is contained in:
Ken Thomases 2013-01-07 14:43:31 -06:00 committed by Alexandre Julliard
parent bbb8c60c7e
commit 573436047e
2 changed files with 20 additions and 10 deletions

View File

@ -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

View File

@ -39,21 +39,26 @@
# include <unistd.h>
#endif
#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"
#ifdef __APPLE__
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
#include <CoreFoundation/CoreFoundation.h>
#include <pthread.h>
#else
extern char **environ;
#endif
/* 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. */