|
From: John M M. <jo...@us...> - 2003-03-05 20:15:09
|
Update of /cvsroot/squeak/squeak/platforms/Mac OS/vm
In directory sc8-pr-cvs1:/tmp/cvs-serv17713/squeak/platforms/Mac OS/vm
Modified Files:
sqMacMain.c
Log Message:
3.5.0b4 Alter for Safari support, use pthreads and project builder
Index: sqMacMain.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/vm/sqMacMain.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** sqMacMain.c 30 Sep 2002 23:54:23 -0000 1.12
--- sqMacMain.c 5 Mar 2003 19:52:18 -0000 1.13
***************
*** 87,94 ****
#if I_AM_CARBON_EVENT
#include <pthread.h>
! extern pthread_mutex_t gEventQueueLock,gEventUILock;
! extern pthread_cond_t gEventUILockCondition;
#endif
!
extern char shortImageName[];
extern char documentName[];
--- 87,96 ----
#if I_AM_CARBON_EVENT
#include <pthread.h>
! extern pthread_mutex_t gEventQueueLock,gEventUILock,gEventDrawLock,gSleepLock;
! extern pthread_cond_t gEventUILockCondition,gSleepLockCondition;
!
! pthread_t gSqueakPThread;
#endif
!
extern char shortImageName[];
extern char documentName[];
***************
*** 247,251 ****
#if I_AM_CARBON_EVENT && defined ( __APPLE__ ) && defined ( __MACH__ )
{
- pthread_t thread;
gThreadManager = false;
--- 249,252 ----
***************
*** 253,257 ****
pthread_mutex_init(&gEventUILock, NULL);
pthread_cond_init(&gEventUILockCondition,NULL);
! err = pthread_create(&thread,null,(void *) interpret, null);
if (err == 0) {
SetUpCarbonEvent();
--- 254,258 ----
pthread_mutex_init(&gEventUILock, NULL);
pthread_cond_init(&gEventUILockCondition,NULL);
! err = pthread_create(&gSqueakPThread,null,(void *) interpret, null);
if (err == 0) {
SetUpCarbonEvent();
***************
*** 283,295 ****
#endif
OSErr createNewThread() {
gSqueakThreadUPP = NewThreadEntryUPP(squeakThread); //We should dispose of someday
!
! #ifndef PLUGIN
! return NewThread( kCooperativeThread, gSqueakThreadUPP, nil, 80*1024, kCreateIfNeeded, 0L, &gSqueakThread);
! #else
! return NewThread( kCooperativeThread, gSqueakThreadUPP, nil, 80*1024, kCreateIfNeeded+kNewSuspend, 0L, &gSqueakThread);
#endif
}
--- 284,317 ----
#endif
+ #ifdef PLUGIN
+ OSErr createNewThread() {
+ #if I_AM_CARBON_EVENT && defined ( __APPLE__ ) && defined ( __MACH__ )
+ {
+ OSErr err;
+
+ gThreadManager = false;
+ pthread_mutex_init(&gEventQueueLock, NULL);
+ pthread_mutex_init(&gEventUILock, NULL);
+ pthread_mutex_init(&gEventDrawLock, NULL);
+ pthread_cond_init(&gEventUILockCondition,NULL);
+ err = pthread_create(&gSqueakPThread,null,(void *) interpret, null);
+ }
+ #else
+ gSqueakThreadUPP = NewThreadEntryUPP(squeakThread); //We should dispose of someday
+ return NewThread( kCooperativeThread, gSqueakThreadUPP, nil, 80*1024, kCreateIfNeeded+kNewSuspend, 0L, &gSqueakThread);
+ #endif
+ }
+ #else
OSErr createNewThread() {
gSqueakThreadUPP = NewThreadEntryUPP(squeakThread); //We should dispose of someday
! return NewThread( kCooperativeThread, gSqueakThreadUPP, nil, 80*1024, kCreateIfNeeded, 0L, &gSqueakThread);
! }
!
#endif
+ pascal short SqueakYieldToAnyThread(void) {
+ #if !defined( I_AM_CARBON_EVENT) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
+ YieldToAnyThread();
+ #endif
}
***************
*** 303,311 ****
}
- pascal short SqueakYieldToAnyThread(void) {
- #ifndef I_AM_CARBON_EVENT
- YieldToAnyThread();
- #endif
- }
#if TARGET_API_MAC_CARBON
--- 325,328 ----
***************
*** 539,542 ****
--- 556,569 ----
if (gThreadManager)
DisposeThread(gSqueakThread,null,true);
+ #if I_AM_CARBON_EVENT && defined ( __APPLE__ ) && defined ( __MACH__ )
+ pthread_cancel(gSqueakPThread);
+ pthread_join(gSqueakPThread,NULL);
+ pthread_mutex_destroy(&gEventQueueLock);
+ pthread_mutex_destroy(&gEventUILock);
+ pthread_mutex_destroy(&gEventDrawLock);
+ pthread_mutex_destroy(&gSleepLock);
+ pthread_cond_destroy(&gEventUILockCondition);
+ pthread_cond_destroy(&gSleepLockCondition);
+ #endif
sqMacMemoryFree();
}
|