ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/main_unix.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/main_unix.cpp (file contents):
Revision 1.50 by gbeauche, 2002-09-17T16:08:07Z vs.
Revision 1.51 by gbeauche, 2002-11-24T20:07:25Z

# Line 94 | Line 94 | extern void (*flush_icache)(int); // fro
94  
95   // Constants
96   const char ROM_FILE_NAME[] = "ROM";
97 + #if !EMULATED_68K
98   const int SIG_STACK_SIZE = SIGSTKSZ;    // Size of signal stack
99 + #endif
100   const int SCRATCH_MEM_SIZE = 0x10000;   // Size of scratch memory area
101  
102  
# Line 123 | Line 125 | Display *x_display = NULL;                                                     // X11
125   static uint8 last_xpram[XPRAM_SIZE];                            // Buffer for monitoring XPRAM changes
126  
127   #ifdef HAVE_PTHREADS
128 + #if !EMULATED_68K
129   static pthread_t emul_thread;                                           // Handle of MacOS emulation thread (main thread)
130 + #endif
131  
132   static bool xpram_thread_active = false;                        // Flag: XPRAM watchdog installed
133   static volatile bool xpram_thread_cancel = false;       // Flag: Cancel XPRAM thread
# Line 157 | Line 161 | uint16 EmulatedSR;                                     // Emulated bits
161   uint8 *ScratchMem = NULL;                       // Scratch memory for Mac ROM writes
162   #endif
163  
164 + #if !defined(HAVE_PTHREADS)
165   static struct sigaction timer_sa;       // sigaction used for timer
166  
167   #if defined(HAVE_TIMER_CREATE) && defined(_POSIX_REALTIME_SIGNALS)
168   #define SIG_TIMER SIGRTMIN
169   static timer_t timer;                           // 60Hz timer
170   #endif
171 + #endif // !HAVE_PTHREADS
172  
173   #ifdef ENABLE_MON
174   static struct sigaction sigint_sa;      // sigaction for SIGINT handler
# Line 503 | Line 509 | int main(int argc, char **argv)
509                  QuitEmulator();
510          D(bug("Initialization complete\n"));
511  
512 + #if !EMULATED_68K
513 +        // (Virtual) supervisor mode, disable interrupts
514 +        EmulatedSR = 0x2700;
515 +
516   #ifdef HAVE_PTHREADS
517          // Get handle of main thread
518          emul_thread = pthread_self();
519   #endif
520  
511 #if !EMULATED_68K
512        // (Virtual) supervisor mode, disable interrupts
513        EmulatedSR = 0x2700;
514
521          // Create and install stack for signal handlers
522          sig_stack = malloc(SIG_STACK_SIZE);
523          D(bug("Signal stack at %p\n", sig_stack));
# Line 821 | Line 827 | struct B2_mutex {
827              pthread_mutex_init(&m, &attr);
828              pthread_mutexattr_destroy(&attr);
829          }
830 <        ~B2_mutex() { pthread_mutex_unlock(&m); pthread_mutex_destroy(&m); }
830 >        ~B2_mutex() {
831 >            pthread_mutex_trylock(&m); // Make sure it's locked before
832 >            pthread_mutex_unlock(&m);  // unlocking it.
833 >            pthread_mutex_destroy(&m);
834 >        }
835          pthread_mutex_t m;
836   };
837  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines