Previous 15994 Revisions Next

r1113 Monday 15th October, 2007 at 13:44:29 UTC by R. Belmont
[SDLMESS] Updates for u4/0.120.
[src/osd/sdl]osinline.h sdlsync.c sdlsync.h sdltime.c sdlwork.c window.c

src/osd/sdl/sdltime.c
r1112r1113
1313#include <SDL/SDL.h>
1414#include <unistd.h>
1515
16#ifdef SDLMAME_UNIX
17#ifndef SDLMAME_DARWIN
18#include <time.h>
19#include <sys/time.h>
20#endif
21#endif
22
1623#ifdef SDLMAME_WIN32
1724#define WIN32_LEAN_AND_MEAN
1825#include <windows.h>
r1112r1113
315322//  time_cycle_counter
316323//============================================================
317324#if defined(SDLMAME_UNIX) && !defined(SDLMAME_DARWIN)
325
326static osd_ticks_t unix_ticks(void)
327{
328      struct timeval    tp;
329      static osd_ticks_t start_sec = 0;
330     
331      gettimeofday(&tp, NULL);
332      if (start_sec==0)
333         start_sec = tp.tv_sec;
334      return (tp.tv_sec - start_sec) * 1000000 + tp.tv_usec;
335}
336
337
318338static osd_ticks_t time_cycle_counter(void)
319339{
320   return SDL_GetTicks();
340   return unix_ticks();
321341}
322342#endif
323343
src/osd/sdl/window.c
r1112r1113
217217      if (work_queue == NULL)
218218         return 1;
219219      osd_work_item_queue(work_queue, &sdlwindow_thread_id, NULL, WORK_ITEM_FLAG_AUTO_RELEASE);
220      //FIXME: Without sleep, Queue will not start to run
221      #if !defined(SDLMAME_WIN32) && !defined(SDLMAME_OS2)
222      usleep(1);
223      #endif
224220   }
225221   else
226222   {
r1112r1113
257253{
258254   if (multithreading_enabled)
259255   {
260      int i;
261      while ( (i=osd_work_queue_items(work_queue)) )
262      {
263//         mame_printf_verbose("Waiting for queue: %s -- %d\n", s, line);
264         #ifndef SDLMAME_WIN32
265         usleep(100);
266         #else
267         Sleep(10);
268         #endif
269      }
256      osd_work_queue_wait(work_queue, osd_ticks_per_second()*10);
270257   }
271258}
272259
src/osd/sdl/sdlsync.c
r1112r1113
1313#ifndef _GNU_SOURCE
1414#define _GNU_SOURCE    // for PTHREAD_MUTEX_RECURSIVE; needs to be here before other glibc headers are included
1515#endif
16#endif
1716
1817#ifdef SDLMAME_MACOSX
1918#include "SDL/SDL.h"
r1112r1113
2120#include "SDL.h"
2221#endif
2322
24#ifdef SDLMAME_WIN32
25#define WIN32_LEAN_AND_MEAN
26#include <windows.h>
27#endif
28
2923#ifdef SDLMAME_OS2
3024#define INCL_DOS
3125#include <os2.h>
r1112r1113
4438#include "mame.h"
4539#include "sdlsync.h"
4640
47#ifndef SDLMAME_WIN32
4841#ifndef SDLMAME_OS2
4942#include <pthread.h>
5043#include <errno.h>
r1112r1113
5750struct _osd_event {
5851   pthread_mutex_t    mutex;
5952   pthread_cond_t       cond;
60   int               autoreset;
61   volatile int      signalled;
53   volatile INT32      autoreset;
54   volatile INT32      signalled;
6255};
6356
6457struct _osd_thread {
6558   pthread_t      thread;
6659};
6760
68static osd_lock      *atomic_lck = NULL;
61static osd_lock         *atomic_lck = NULL;
6962
7063//============================================================
7164//  osd_lock_alloc
r1112r1113
181174   pthread_cond_init(&ev->cond, NULL);
182175   ev->signalled = initialstate;
183176   ev->autoreset = !manualreset;
184   
177      
185178   return ev;
186179}
187180
r1112r1113
202195
203196void osd_event_set(osd_event *event)
204197{
198#if 0
199   if (osd_compare_exchange32(&event->signalled, FALSE, TRUE) == FALSE)
200   {
201      pthread_mutex_lock(&event->mutex);
202      if (event->autoreset)
203         pthread_cond_signal(&event->cond);
204      else
205         pthread_cond_broadcast(&event->cond);
206      pthread_mutex_unlock(&event->mutex);
207   }
208#endif
205209   pthread_mutex_lock(&event->mutex);
206   event->signalled = TRUE;
207   pthread_cond_broadcast(&event->cond);
210   if (event->signalled == FALSE)
211   {
212      event->signalled = TRUE;
213      if (event->autoreset)
214         pthread_cond_signal(&event->cond);
215      else
216         pthread_cond_broadcast(&event->cond);
217   }
208218   pthread_mutex_unlock(&event->mutex);
209219}
210220
r1112r1113
230240   {
231241      if (!event->signalled)
232242      {
233         pthread_cond_wait(&event->cond, &event->mutex);
243            pthread_mutex_unlock(&event->mutex);
244            return FALSE;
234245      }
235   }
246   }
236247   else
237248   {
238249      struct timespec   ts;
r1112r1113
249260      ts.tv_sec += t;
250261
251262      if (!event->signalled)
263      {
252264         if ( pthread_cond_timedwait(&event->cond, &event->mutex, &ts) != 0 )
253265         {
254266            pthread_mutex_unlock(&event->mutex);
255267            return FALSE;
256268         }
269      }
257270   }
271
258272   if (event->autoreset)
259273      event->signalled = 0;
274
260275   pthread_mutex_unlock(&event->mutex);
276
261277   return TRUE;
262278}
263
264//============================================================
265//  osd_event_wait_multiple
266//============================================================
267
268int osd_event_wait_multiple(int num, osd_event *events[], osd_ticks_t timeout)
269{
270   int i;
271   int ret;
272   
273   //FIXME: ugly and inefficient and ignores timeout
274   do
275   {
276      for (i=0;i<num;i++)
277      {
278         ret = osd_event_wait(events[i], 10);
279         if (ret == TRUE)
280            return (i);
281      }
282      osd_sleep(20);
283   }
284   while (TRUE);
285   return -1;
286}
287279 
288280//============================================================
289281//  osd_atomic_lock
r1112r1113
312304osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam)
313305{
314306   osd_thread *thread;
307   pthread_attr_t   attr;
315308
316309   thread = (osd_thread *)calloc(1, sizeof(osd_thread));
317   if ( pthread_create(&thread->thread, NULL, callback, cbparam) != 0 )
310   pthread_attr_init(&attr);
311   pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
312   if ( pthread_create(&thread->thread, &attr, callback, cbparam) != 0 )
318313   {
319314      free(thread);
320315      return NULL;
r1112r1113
357352//  osd_compare_exchange32
358353//============================================================
359354
360#if defined(__i386__) || defined(__x86_64__)
355#ifndef osd_compare_exchange32
361356
362357INT32 osd_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
363358{
364   register INT32 ret;
365   __asm__ __volatile__ (
366      " lock ; cmpxchg %[exchange], %[ptr] ;"
367      : [ptr] "+m" (*ptr)
368      , [ret] "=a" (ret)
369      : [compare] "1" (compare)
370      , [exchange] "q" (exchange)
371      : "%cc"
372   );
373   return ret;
374}
375
376#elif defined(__ppc__) || defined(__PPC__) || defined(__ppc64__) || defined(__PPC64__)
377
378INT32 osd_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
379{
380   register INT32 ret;
381   __asm__ __volatile__ (
382      "1: lwarx %[ret], 0, %[ptr] \n"
383      " cmpw %[compare], %[ret] \n"
384      " bne 2f \n"
385      " sync \n"
386      " stwcx. %[exchange], 0, %[ptr] \n"
387      " bne- 1b \n"
388      "2: "
389      : [ret] "=&r" (ret)
390      : [ptr] "r" (ptr)
391      , [exchange] "r" (exchange)
392      , [compare] "r" (compare)
393      : "cr0"
394   );
395   return ret;
396}
397#else
398
399INT32 osd_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
400{
401359   INT32   ret;
402360   osd_atomic_lock();
403361
r1112r1113
418376//  osd_compare_exchange64
419377//============================================================
420378
421#if defined(__x86_64__)
379#ifndef osd_compare_exchange64
422380
423381INT64 osd_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
424382{
425   register INT64 ret;
426   __asm__ __volatile__ (
427      " lock ; cmpxchg %[exchange], %[ptr] ;"
428      : [ptr] "+m" (*ptr)
429      , [ret] "=a" (ret)
430      : [compare] "1" (compare)
431      , [exchange] "q" (exchange)
432      : "%cc"
433   );
434   return ret;
435}
436
437#elif defined(__ppc64__) || defined(__PPC64__)
438
439INT64 osd_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
440{
441   register INT64 ret;
442   __asm__ __volatile__ (
443      "1: ldarx %[ret], 0, %[ptr] \n"
444      " cmpd %[compare], %[ret] \n"
445      " bne 2f \n"
446      " stdcx. %[exchange], 0, %[ptr] \n"
447      " bne-- 1b \n"
448      "2: "
449      : [ret] "=&r" (ret)
450      : [ptr] "r" (ptr)
451      , [exchange] "r" (exchange)
452      , [compare] "r" (compare)
453      : "cr0"
454   );
455   return ret;
456}
457#else
458
459#ifdef PTR64
460INT64 osd_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
461{
462383   INT64   ret;
463384   osd_atomic_lock();
464385
r1112r1113
472393   osd_atomic_unlock();   
473394   return ret;
474395}
475#endif
476396
477397#endif
478398
src/osd/sdl/sdlsync.h
r1112r1113
215215-----------------------------------------------------------------------------*/
216216void osd_atomic_lock(void);
217217
218
219218/*-----------------------------------------------------------------------------
220219    osd_atomic_unlock: unblock other processes
221220
r1112r1113
234233void osd_atomic_unlock(void);
235234
236235
237//============================================================
238//  INLINE FUNCTIONS
239//============================================================
240
241#ifndef SDLMAME_WIN32
242#ifdef X86_ASM
243
244INLINE void * osd_atomic_cmpxchg(void * volatile *ptr, void *exchange, void *compare)
245{
246   long prev;
247   __asm__ __volatile__("lock; cmpxchgl %1,%2"
248                  : "=a"(prev)
249                  : "r"((long) exchange), "m"(*ptr), "0"((long) compare)
250                  : "memory");
251   return (void *) prev;
252}
253
254INLINE long osd_atomic_increment(long volatile *addend)
255{
256   __asm__ __volatile__(
257      "lock;" "incl %0"
258      :"=m" (*addend)
259      :"m" (*addend));
260   return *addend;
261}
262
263
264INLINE long osd_atomic_decrement(long volatile *addend)
265{
266   __asm__ __volatile__(
267      "lock;" "decl %0"
268      :"=m" (*addend)
269      :"m" (*addend));
270   return *addend;
271}
272#else
273
274INLINE void * osd_atomic_cmpxchg(void * volatile *ptr, void *exchange, void *compare)
275{
276   void *ret = NULL;
277
278   osd_atomic_lock();
279
280#ifdef PTR64
281   ret = (void*)(*((UINT64*)ptr));
282
283   if ( *((UINT64*)ptr) == (UINT64)compare )
284   {
285      *((UINT64*)ptr) = (UINT64)exchange;
286   }
287#else
288   ret = (void*)(*((UINT32*)ptr));
289
290   if ( *((UINT32*)ptr) == (UINT32)compare )
291   {
292      *((UINT32*)ptr) = (UINT32)exchange;
293   }
294#endif
295
296   osd_atomic_unlock();
297
298   return ret;
299}
300
301INLINE long osd_atomic_increment(long volatile *addend)
302{
303   long ret;
304   osd_atomic_lock();
305   ret = (++(*addend));
306   osd_atomic_unlock();
307   return ret;
308}
309
310
311INLINE long osd_atomic_decrement(long volatile *addend)
312{
313   long ret;
314   osd_atomic_lock();
315   ret = (--(*addend));
316   osd_atomic_unlock();
317   return ret;
318}
319#endif
320
321#else //SDLMAME_WIN32
322
323INLINE PVOID osd_atomic_cmpxchg(PVOID volatile *ptr, PVOID exchange, PVOID compare)
324{
325   // the mingw headers don't put the volatile keyword on the first parameter
326   // gcc also can't handle casting the result of a function
327#ifdef __GNUC__
328#ifdef PTR64
329   UINT64 result = InterlockedCompareExchange64((UINT64)ptr, (UINT64)exchange, (UINT64)compare);
330   return (PVOID)result;
331#else
332   LONG result = InterlockedCompareExchange((LPLONG)ptr, (LONG)exchange, (LONG)compare);
333   return (PVOID)result;
334#endif
335#else
336   return InterlockedCompareExchangePointer(ptr, exchange, compare);
337#endif
338}
339
340
341INLINE LONG osd_atomic_increment(LONG volatile *addend)
342{
343   // the mingw headers don't put the volatile keyword on the first parameter
344#ifdef __GNUC__
345   return InterlockedIncrement((LPLONG)addend);
346#else
347   return InterlockedIncrement(addend);
348#endif
349}
350
351
352INLINE LONG osd_atomic_decrement(LONG volatile *addend)
353{
354   // the mingw headers don't put the volatile keyword on the first parameter
355#ifdef __GNUC__
356   return InterlockedDecrement((LPLONG)addend);
357#else
358   return InterlockedDecrement(addend);
359#endif
360}
361
362#endif
363
364236#endif   /* SDLMAME_WIN32 */
237
365238#endif   /* __SDL_SYNC__ */
src/osd/sdl/osinline.h
r1112r1113
11//============================================================
22//
3//   osinline.h - Win32 inline functions
3//   osinline.h - GNU C inline functions
44//
55//============================================================
66
r1112r1113
1313//   INLINE FUNCTIONS
1414//============================================================
1515
16//#define YieldProcessor() sched_yield()
17//#define YieldProcessor() do {} while (0)
1618
19#ifndef YieldProcessor
20
21#if defined(__i386__) || defined(__x86_64__)
22
23INLINE void osd_yield_processor(void)
24{
25   __asm__ __volatile__ ( " rep ; nop ;" );
26}
27
28#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__)
29
30INLINE void osd_yield_processor(void)
31{
32   __asm__ __volatile__ ( " nop \n" );
33}
34
35#endif
36
37#else
38#define osd_yield_processor() YieldProcessor()
39#endif
40
41#ifdef __GNUC__
42
43#if defined(__i386__) || defined(__x86_64__)
44
45
46//============================================================
47//  osd_compare_exchange32
48//============================================================
49#ifndef SDLMAME_WIN32
50ATTR_UNUSED
51INLINE INT32 _osd_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
52{
53   register INT32 ret;
54   __asm__ __volatile__ (
55      " lock ; cmpxchg %[exchange], %[ptr] ;"
56      : [ptr]      "+m" (*ptr)
57      , [ret]      "=a" (ret)
58      : [compare]  "1"  (compare)
59      , [exchange] "q"  (exchange)
60      : "%cc"
61   );
62   return ret;
63}
64#define osd_compare_exchange32 _osd_compare_exchange32
65
66
67//============================================================
68//  osd_exchange32
69//============================================================
70
71ATTR_UNUSED
72INLINE INT32 _osd_exchange32(INT32 volatile *ptr, INT32 exchange)
73{
74   register INT32 ret;
75   __asm__ __volatile__ (
76      " lock ; xchg %[exchange], %[ptr] ;"
77      : [ptr]      "+m" (*ptr)
78      , [ret]      "=r" (ret)
79      : [exchange] "1"  (exchange)
80   );
81   return ret;
82}
83#define osd_exchange32 _osd_exchange32
84#endif
85
86//============================================================
87//  osd_sync_add
88//============================================================
89
90ATTR_UNUSED
91INLINE INT32 _osd_sync_add(INT32 volatile *ptr, INT32 delta)
92{
93   register INT32 ret;
94   __asm __volatile__ (
95      " mov           %[delta],%[ret] ;"
96      " lock ; xadd   %[ret],%[ptr]   ;"
97      " add           %[delta],%[ret] ;"
98      : [ptr]   "+m"  (*ptr)
99      , [ret]   "=&r" (ret)
100      : [delta] "rmi" (delta)
101      : "%cc"
102   );
103   return ret;
104}
105#define osd_sync_add _osd_sync_add
106
107
108//============================================================
109//  osd_interlocked_increment
110//============================================================
111
112ATTR_UNUSED
113INLINE INT32 _osd_interlocked_increment(INT32 volatile *ptr)
114{
115   register INT32 ret;
116   __asm__ __volatile__(
117      " mov           $1,%[ret]     ;"
118      " lock ; xadd   %[ret],%[ptr] ;"
119      " inc           %[ret]        ;"
120      : [ptr] "+m"  (*ptr)
121      , [ret] "=&r" (ret)
122      :
123      : "%cc"
124   );
125   return ret;
126}
127#define osd_interlocked_increment _osd_interlocked_increment
128
129
130//============================================================
131//  osd_interlocked_decrement
132//============================================================
133
134ATTR_UNUSED
135INLINE INT32 _osd_interlocked_decrement(INT32 volatile *ptr)
136{
137   register INT32 ret;
138   __asm__ __volatile__(
139      " mov           $-1,%[ret]    ;"
140      " lock ; xadd   %[ret],%[ptr] ;"
141      " dec           %[ret]        ;"
142      : [ptr] "+m"  (*ptr)
143      , [ret] "=&r" (ret)
144      :
145      : "%cc"
146   );
147   return ret;
148}
149#define osd_interlocked_decrement _osd_interlocked_decrement
150
151
152#if defined(__x86_64__)
153
154//============================================================
155//  osd_compare_exchange64
156//============================================================
157
158ATTR_UNUSED
159INLINE INT64 _osd_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
160{
161   register INT64 ret;
162   __asm__ __volatile__ (
163      " lock ; cmpxchg %[exchange], %[ptr] ;"
164      : [ptr]      "+m" (*ptr)
165      , [ret]      "=a" (ret)
166      : [compare]  "1"  (compare)
167      , [exchange] "q"  (exchange)
168      : "%cc"
169   );
170   return ret;
171}
172#define osd_compare_exchange64 _osd_compare_exchange64
173
174#endif /* __x86_64__ */
175
176
177#elif defined(__ppc__) || defined(__PPC__) || defined(__ppc64__) || defined(__PPC64__)
178
179
180//============================================================
181//  osd_compare_exchange32
182//============================================================
183
184ATTR_UNUSED
185INLINE INT32 _osd_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
186{
187   register INT32 ret;
188   __asm__ __volatile__ (
189      "1: lwarx  %[ret], 0, %[ptr]      \n"
190      "   cmpw   %[compare], %[ret]     \n"
191      "   bne    2f                     \n"
192      "   sync                          \n"
193      "   stwcx. %[exchange], 0, %[ptr] \n"
194      "   bne- 1b                       \n"
195      "2:                                 "
196      : [ret]      "=&r" (ret)
197      : [ptr]      "r"   (ptr)
198      , [exchange] "r"   (exchange)
199      , [compare]  "r"   (compare)
200      : "cr0"
201   );
202   return ret;
203}
204#define osd_compare_exchange32 _osd_compare_exchange32
205
206
207//============================================================
208//  osd_exchange32
209//============================================================
210
211ATTR_UNUSED
212INLINE INT32 _osd_exchange32(INT32 volatile *ptr, INT32 exchange)
213{
214   register INT32 ret;
215   __asm__ __volatile__ (
216      "1: lwarx  %[ret], 0, %[ptr]      \n"
217      "   sync                          \n"
218      "   stwcx. %[exchange], 0, %[ptr] \n"
219      "   bne-   1b                     \n"
220      : [ret]      "=&r" (ret)
221      : [ptr]      "r"   (ptr)
222      , [exchange] "r"   (exchange)
223      : "cr0"
224   );
225   return ret;
226}
227#define osd_exchange32 _osd_exchange32
228
229
230//============================================================
231//  osd_sync_add
232//============================================================
233
234ATTR_UNUSED
235INLINE INT32 _osd_sync_add(INT32 volatile *ptr, INT32 delta)
236{
237   register INT32 ret;
238   __asm __volatile__ (
239      "1: lwarx  %[ret], 0, %[ptr]        \n"
240      "   add    %[ret], %[ret], %[delta] \n"
241      "   sync                            \n"
242      "   stwcx. %[ret], 0, %[ptr]        \n"
243      "   bne- 1b                         \n"
244      : [ret]   "=&b" (ret)
245      : [ptr]   "r"   (ptr)
246      , [delta] "r"   (delta)
247      : "cr0"
248   );
249   return ret;
250}
251#define osd_sync_add _osd_sync_add
252
253
254//============================================================
255//  osd_interlocked_increment
256//============================================================
257
258ATTR_UNUSED
259INLINE INT32 _osd_interlocked_increment(INT32 volatile *ptr)
260{
261   register INT32 ret;
262   __asm__ __volatile__(
263      "1: lwarx  %[ret], 0, %[ptr] \n"
264      "   addi   %[ret], %[ret], 1 \n"
265      "   sync                     \n"
266      "   stwcx. %[ret], 0, %[ptr] \n"
267      "   bne-   1b                \n"
268      : [ret] "=&b" (ret)
269      : [ptr] "r"   (ptr)
270      : "cr0"
271   );
272   return ret;
273}
274#define osd_interlocked_increment _osd_interlocked_increment
275
276
277//============================================================
278//  osd_interlocked_decrement
279//============================================================
280
281ATTR_UNUSED
282INLINE INT32 _osd_interlocked_decrement(INT32 volatile *ptr)
283{
284   register INT32 ret;
285   __asm__ __volatile__(
286      "1: lwarx  %[ret], 0, %[ptr]  \n"
287      "   addi   %[ret], %[ret], -1 \n"
288      "   sync                      \n"
289      "   stwcx. %[ret], 0, %[ptr]  \n"
290      "   bne-   1b                 \n"
291      : [ret] "=&b" (ret)
292      : [ptr] "r"   (ptr)
293      : "cr0"
294   );
295   return ret;
296}
297#define osd_interlocked_decrement _osd_interlocked_decrement
298
299
300#if defined(__ppc64__) || defined(__PPC64__)
301
302//============================================================
303//  osd_compare_exchange64
304//============================================================
305
306ATTR_UNUSED
307INLINE INT64 _osd_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
308{
309   register INT64 ret;
310   __asm__ __volatile__ (
311      "1: ldarx  %[ret], 0, %[ptr]      \n"
312      "   cmpd   %[compare], %[ret]     \n"
313      "   bne    2f                     \n"
314      "   stdcx. %[exchange], 0, %[ptr] \n"
315      "   bne--  1b                     \n"
316      "2:                                 "
317      : [ret]      "=&r" (ret)
318      : [ptr]      "r"   (ptr)
319      , [exchange] "r"   (exchange)
320      , [compare]  "r"   (compare)
321      : "cr0"
322   );
323   return ret;
324}
325#define osd_compare_exchange64 _osd_compare_exchange64
326
327#endif /* __ppc64__ || __PPC64__ */
328
329
330#endif
331
332#endif /* __GNUC__ */
333
334
17335#endif /* __OSINLINE__ */
src/osd/sdl/sdlwork.c
r1112r1113
1//============================================================
12//
23//  sdlwork.c - SDL OSD core work item functions
34//
r1112r1113
2324#include <pthread.h>
2425#include <unistd.h>
2526#include "osdcore.h"
27#include "osinline.h"
2628
2729#ifdef SDLMAME_DARWIN
2830#include <mach/mach.h>
r1112r1113
4042
4143
4244//============================================================
45//  PARAMETERS
46//============================================================
47
48#define INFINITE            (osd_ticks_per_second()*10000)
49#define MAX_THREADS            (16)
50#define SPIN_LOOP_TIME         (osd_ticks_per_second() / 1000)
51
52
53
54//============================================================
4355//  MACROS
4456//============================================================
4557
4658#if KEEP_STATISTICS
47#define add_to_stat(v,x)      do { osd_sync_add((v), (x)); } while (0)
59#define add_to_stat(v,x)      do { osd_interlocked_add((v), (x)); } while (0)
60#define begin_timing(v)         do { (v) -= osd_profiling_ticks(); } while (0)
61#define end_timing(v)         do { (v) += osd_profiling_ticks(); } while (0)
4862#else
4963#define add_to_stat(v,x)      do { } while (0)
64#define begin_timing(v)         do { } while (0)
65#define end_timing(v)         do { } while (0)
5066#endif
5167
52#ifndef YieldProcessor
5368
54#if defined(__i386__) || defined(__x86_64__)
5569
56INLINE void YieldProcessor(void)
57{
58   __asm__ __volatile__ ( " rep ; nop ;" );
59}
70//============================================================
71//  TYPE DEFINITIONS
72//============================================================
6073
61#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__)
62
63INLINE void YieldProcessor(void)
74typedef struct _scalable_lock scalable_lock;
75struct _scalable_lock
6476{
65   __asm__ __volatile__ ( " nop \n" );
66}
77   struct
78   {
79      volatile INT32    haslock;      // do we have the lock?
80      UINT8          filler[60];      // assumes a 64-byte cache line
81   } slot[MAX_THREADS];               // one slot per thread
82   volatile INT32       nextindex;      // index of next slot to use
83};
6784
68#endif
6985
70#endif
71
72
73
74//============================================================
75//  TYPE DEFINITIONS
76//============================================================
77
7886typedef struct _mame_thread_info mame_thread_info;
7987struct _mame_thread_info
8088{
8189   osd_work_queue *   queue;         // pointer back to the queue
8290   osd_thread *      handle;         // handle to the thread
8391   osd_event *         wakeevent;      // wake event for the thread
84   UINT8            active;         // are we actively processing work?
92   volatile UINT8      active;         // are we actively processing work?
93
94#if KEEP_STATISTICS
95   osd_ticks_t         runtime;
96   osd_ticks_t         spintime;
97   osd_ticks_t         waittime;
98#endif
8599};
86100
87101
88102struct _osd_work_queue
89103{
90   osd_lock *         critsect;      // critical section protecting the queue
104   scalable_lock       lock;         // lock for protecting the queue
91105   osd_work_item * volatile list;      // list of items in the queue
92106   osd_work_item ** volatile tailptr;   // pointer to the tail pointer of work items in the queue
93107   osd_work_item * volatile free;      // free list of work items
94108   volatile INT32      items;         // items in the queue
95109   volatile INT32      livethreads;   // number of live threads
110   volatile UINT8      waiting;      // is someone waiting on the queue to complete?
111   volatile UINT8      exiting;      // should the threads exit on their next opportunity?
96112   UINT32            threads;      // number of threads in this queue
97113   UINT32            flags;         // creation flags
98114   mame_thread_info *   thread;         // array of thread information
99   osd_event *         workevent;      // shared event signalled when work is available
100   osd_event *         doneevent;      // event signalled when work is complete
101   osd_event *         exitevent;      // event signalled when thread should exit
115   osd_event   *      doneevent;      // event signalled when work is complete
102116
103117#if KEEP_STATISTICS
104118   volatile INT32      itemsqueued;   // total items queued
r1112r1113
118132   void *            result;         // callback result
119133   osd_event *         event;         // event signalled when complete
120134   UINT32            flags;         // creation flags
121   volatile INT32      refcount;      // reference count of threads processing
135   volatile UINT8      done;         // is the item done?
122136};
123137
124138
r1112r1113
130144static int effective_num_processors(void);
131145static void * worker_thread_entry(void *param);
132146static void worker_thread_process(osd_work_queue *queue, mame_thread_info *thread);
133static void execute_work_item(osd_work_item *item);
134147
135148//============================================================
149//  INLINE FUNCTIONS
150//============================================================
151
152#ifndef osd_exchange32
153INLINE INT32 osd_exchange32(INT32 volatile *ptr, INT32 exchange)
154{
155   INT32 origvalue;
156   do {
157      origvalue = *ptr;
158   } while (osd_compare_exchange32(ptr, origvalue, exchange) != origvalue);
159   return origvalue;
160}
161#endif
162
163#ifndef osd_interlocked_increment
164INLINE INT32 osd_interlocked_increment(INT32 volatile *ptr)
165{
166   return osd_sync_add(ptr, 1);
167}
168#endif
169
170#ifndef osd_interlocked_decrement
171INLINE INT32 osd_interlocked_decrement(INT32 volatile *ptr)
172{
173   return osd_sync_add(ptr, -1);
174}
175#endif
176
177#ifndef osd_interlocked_add
178INLINE INT32 osd_interlocked_add(INT32 volatile *ptr, INT32 add)
179{
180   return osd_sync_add(ptr, add);
181}
182#endif
183
184INLINE void scalable_lock_init(scalable_lock *lock)
185{
186   memset(lock, 0, sizeof(*lock));
187   lock->slot[0].haslock = TRUE;
188}
189
190
191INT32 scalable_lock_acquire(scalable_lock *lock)
192{
193   INT32 myslot = (osd_interlocked_increment(&lock->nextindex) - 1) & (MAX_THREADS - 1);
194   INT32 backoff = 1;
195
196   while (!osd_compare_exchange32(&lock->slot[myslot].haslock, TRUE, FALSE))
197   {
198      INT32 backcount;
199      for (backcount = 0; backcount < backoff; backcount++)
200         osd_yield_processor();
201      backoff <<= 1;
202   }
203   return myslot;
204}
205
206void scalable_lock_release(scalable_lock *lock, INT32 myslot)
207{
208   osd_exchange32(&lock->slot[(myslot + 1) & (MAX_THREADS - 1)].haslock, TRUE);
209}
210
211
212//============================================================
136213//  osd_work_queue_alloc
137214//============================================================
138215
r1112r1113
153230   queue->flags = flags;
154231
155232   // allocate events for the queue
156   queue->workevent = osd_event_alloc(FALSE, FALSE);   // auto-reset, not signalled
157233   queue->doneevent = osd_event_alloc(TRUE, TRUE);      // manual reset, signalled
158   queue->exitevent = osd_event_alloc(TRUE, FALSE);   // manual reset, not signalled
159   if (queue->workevent == NULL || queue->doneevent == NULL || queue->exitevent == NULL)
234   if (queue->doneevent == NULL)
160235      goto error;
161236
162237   // initialize the critical section
163   if ( (queue->critsect = osd_lock_alloc()) == NULL )
164      goto error;
238   scalable_lock_init(&queue->lock);
165239
166240   // determine how many threads to create...
167241   // on a single-CPU system, create 1 thread for I/O queues, and 0 threads for everything else
r1112r1113
172246   else
173247      queue->threads = (flags & WORK_QUEUE_FLAG_MULTI) ? (numprocs - 1) : 1;
174248
175   // if we have threads, create them
176   if (queue->threads > 0)
249   // clamp to the maximum
250   queue->threads = MIN(queue->threads, MAX_THREADS);
251
252   // allocate memory for thread array (+1 to count the calling thread)
253   queue->thread = malloc((queue->threads + 1) * sizeof(queue->thread[0]));
254   if (queue->thread == NULL)
255      goto error;
256   memset(queue->thread, 0, (queue->threads + 1) * sizeof(queue->thread[0]));
257
258   // iterate over threads
259   for (threadnum = 0; threadnum < queue->threads; threadnum++)
177260   {
178      // allocate memory for thread array
179      queue->thread = malloc(queue->threads * sizeof(queue->thread[0]));
180      if (queue->thread == NULL)
181         goto error;
182      memset(queue->thread, 0, queue->threads * sizeof(queue->thread[0]));
261      mame_thread_info *thread = &queue->thread[threadnum];
183262
184      // iterate over threads
185      for (threadnum = 0; threadnum < queue->threads; threadnum++)
186      {
187         mame_thread_info *thread = &queue->thread[threadnum];
263      // set a pointer back to the queue
264      thread->queue = queue;
188265
189         // set a pointer back to the queue
190         thread->queue = queue;
266      // create the per-thread wake event
267      thread->wakeevent = osd_event_alloc(FALSE, FALSE);   // auto-reset, not signalled
268      if (thread->wakeevent == NULL)
269         goto error;
191270
192         // create the per-thread wake event
193         thread->wakeevent = osd_event_alloc(FALSE, FALSE);   // auto-reset, not signalled
194         if (thread->wakeevent == NULL)
195            goto error;
271      // create the thread
272      thread->handle = osd_thread_create(worker_thread_entry, thread);
273      if (thread->handle == NULL)
274         goto error;
196275
197         // create the thread
198         thread->handle = osd_thread_create(worker_thread_entry, thread);
199         if (thread->handle == NULL)
200            goto error;
276      // set its priority: I/O threads get high priority because they are assumed to be
277      // blocked most of the time; other threads just match the creator's priority
278      if (flags & WORK_QUEUE_FLAG_IO)
279         osd_thread_adjust_priority(thread->handle, 0);   // TODO: specify appropriate priority
280      else
281         osd_thread_adjust_priority(thread->handle, 0);   // TODO: specify appropriate priority
282   }
201283
202         // set its priority: I/O threads get high priority because they are assumed to be
203         // blocked most of the time; other threads just match the creator's priority
204         if (flags & WORK_QUEUE_FLAG_IO)
205            osd_thread_adjust_priority(thread->handle, 0);   // TODO: specify appropriate priority
206         else
207            osd_thread_adjust_priority(thread->handle, 0);   // TODO: specify appropriate priority
208      }
209   }
284   // start a timer going for "waittime" on the main thread
285   begin_timing(queue->thread[queue->threads].waittime);
210286   return queue;
211287
212288error:
r1112r1113
243319   // if this is a multi queue, help out rather than doing nothing
244320   if (queue->flags & WORK_QUEUE_FLAG_MULTI)
245321   {
246      osd_ticks_t stopspin = osd_ticks() + timeout;
322      mame_thread_info *thread = &queue->thread[queue->threads];
247323
324      end_timing(thread->waittime);
325
248326      // process what we can as a worker thread
249      worker_thread_process(queue, NULL);
327      worker_thread_process(queue, thread);
250328
251      // spin until we hit 0 items and then return TRUE
252      while (queue->items != 0 && osd_ticks() < stopspin)
253         YieldProcessor();
329      begin_timing(thread->waittime);
254330      return TRUE;
255331   }
256332
257333   // reset our done event and double-check the items before waiting
258334   osd_event_reset(queue->doneevent);
259   if (queue->items == 0)
260      return TRUE;
335   queue->waiting = TRUE;
336   if (queue->items != 0)
337   {
338      osd_event_wait(queue->doneevent, timeout);
339   }
340   queue->waiting = FALSE;
261341
262   // wait for the collection to be signalled
263   return (osd_event_wait(queue->doneevent, timeout));
342   // return TRUE if we actually hit 0
343   return (queue->items == 0);
264344}
265345
266346
r1112r1113
275355   {
276356      int threadnum;
277357
358      // stop the timer for "waittime" on the main thread
359      end_timing(queue->thread[queue->threads].waittime);
360
278361      // signal all the threads to exit
279      osd_event_set(queue->exitevent);
362      //osd_work_queue_wait(queue, osd_ticks_per_second()*10);
363      queue->exiting = TRUE;
364      for (threadnum = 0; threadnum < queue->threads; threadnum++)
365      {
366         mame_thread_info *thread = &queue->thread[threadnum];
367         if (thread->wakeevent != NULL)
368            osd_event_set(thread->wakeevent);
369      }
280370
281371      // wait for all the threads to go away
282372      for (threadnum = 0; threadnum < queue->threads; threadnum++)
r1112r1113
294384            osd_event_free(thread->wakeevent);
295385      }
296386
387#if KEEP_STATISTICS
388      // output per-thread statistics
389      for (threadnum = 0; threadnum <= queue->threads; threadnum++)
390      {
391         mame_thread_info *thread = &queue->thread[threadnum];
392         osd_ticks_t total = thread->runtime + thread->waittime + thread->spintime;
393         printf("Thread %d:  run=%5.2f%%  spin=%5.2f%%  wait/other=%5.2f%%\n",
394               threadnum,
395               (double)thread->runtime * 100.0 / (double)total,
396               (double)thread->spintime * 100.0 / (double)total,
397               (double)thread->waittime * 100.0 / (double)total);
398      }
399#endif
400
297401      // free the list
298402      free(queue->thread);
299403   }
300404
301405   // free all the events
302   if (queue->workevent != NULL)
303      osd_event_free(queue->workevent);
304406   if (queue->doneevent != NULL)
305407      osd_event_free(queue->doneevent);
306   if (queue->exitevent != NULL)
307      osd_event_free(queue->exitevent);
308408
309   // free the critical section
310   osd_lock_free(queue->critsect);
311
312409   // free all items in the free list
313410   while (queue->free != NULL)
314411   {
r1112r1113
342439
343440
344441//============================================================
345//  osd_work_item_queue
442//  osd_work_item_queue_multiple
346443//============================================================
347444
348osd_work_item *osd_work_item_queue(osd_work_queue *queue, osd_work_callback callback, void *param, UINT32 flags)
445osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_callback callback, INT32 numitems, void *parambase, INT32 paramstep, UINT32 flags)
349446{
350   osd_work_item *item;
447   osd_work_item *itemlist = NULL;
448   osd_work_item **item_tailptr = &itemlist;
449   INT32 lockslot;
450   int itemnum;
351451
352   // first allocate a new work item; try the free list first
353   do
452   // loop over items, building up a local list of work
453   for (itemnum = 0; itemnum < numitems; itemnum++)
354454   {
355      item = (osd_work_item *)queue->free;
356   } while (item != NULL && osd_compare_exchange_ptr((void * volatile *)&queue->free, item, item->next) != item);
455      osd_work_item *item;
357456
358   // if nothing, allocate something new
359   if (item == NULL)
360   {
361      // allocate the item
362      item = malloc(sizeof(*item));
457      // first allocate a new work item; try the free list first
458      do
459      {
460         item = (osd_work_item *)queue->free;
461      } while (item != NULL && osd_compare_exchange_ptr((void * volatile *)&queue->free, item, item->next) != item);
462
463      // if nothing, allocate something new
363464      if (item == NULL)
364         return NULL;
365      item->event = NULL;
366      item->queue = queue;
465      {
466         // allocate the item
467         item = malloc(sizeof(*item));
468         if (item == NULL)
469            return NULL;
470         item->event = NULL;
471         item->queue = queue;
472      }
473
474      // fill in the basics
475      item->next = NULL;
476      item->callback = callback;
477      item->param = parambase;
478      item->result = NULL;
479      item->flags = flags;
480      item->done = FALSE;
481
482      // advance to the next
483      *item_tailptr = item;
484      item_tailptr = &item->next;
485      parambase = (UINT8 *)parambase + paramstep;
367486   }
368487
369   // fill in the basics
370   item->next = NULL;
371   item->callback = callback;
372   item->param = param;
373   item->result = NULL;
374   item->flags = flags;
375   item->refcount = 1;
376   if (item->event != NULL)
377      osd_event_reset(item->event);
488   // enqueue the whole thing within the critical section
489   lockslot = scalable_lock_acquire(&queue->lock);
490   *queue->tailptr = itemlist;
491   queue->tailptr = item_tailptr;
492   scalable_lock_release(&queue->lock, lockslot);
378493
379   // if no threads, just run it now
380   if (queue->threads == 0)
381   {
382      // execute the callback and clear the refcount back to 0
383      item->result = (*item->callback)(item->param);
384      item->refcount = 0;
494   // increment the number of items in the queue
495   osd_interlocked_add(&queue->items, numitems);
496   add_to_stat(&queue->itemsqueued, numitems);
385497
386      // handle auto-release; make sure we return NULL in that case
387      if (flags & WORK_ITEM_FLAG_AUTO_RELEASE)
388         osd_work_item_release(item);
389   }
390
391   // otherwise, enqueue the item and wake the threads
392   else
498   // look for free threads to do the work
499   if (queue->livethreads < queue->threads)
393500   {
394      // enqueue within the critical section
395      osd_lock_acquire(queue->critsect);
396      *queue->tailptr = item;
397      queue->tailptr = (osd_work_item **)&item->next;
398      osd_lock_release(queue->critsect);
501      int threadnum;
399502
400      // increment the number of items in the queue
401      osd_sync_add(&queue->items, 1);
402      add_to_stat(&queue->itemsqueued, 1);
503      // iterate over all the threads
504      for (threadnum = 0; threadnum < queue->threads; threadnum++)
505      {
506         mame_thread_info *thread = &queue->thread[threadnum];
403507
404      // non-shared case
405      if (!(flags & WORK_ITEM_FLAG_SHARED))
406      {
407         // if there are still some free threads, signal the shared work event
408         if (queue->livethreads < queue->threads)
508         // if this thread is not active, wake him up
509         if (!thread->active)
409510         {
410            osd_event_set(queue->workevent);
511            osd_event_set(thread->wakeevent);
411512            add_to_stat(&queue->setevents, 1);
513
514            // for non-shared, the first one we find is good enough
515            if (--numitems == 0)
516               break;
412517         }
413518      }
519   }
414520
415      // shared case
416      else
417      {
418         int threadnum;
521   // if no threads, run the queue now on this thread
522   if (queue->threads == 0)
523      worker_thread_process(queue, &queue->thread[0]);
419524
420         // signal the wake event for all non-active threads
421         for (threadnum = 0; threadnum < queue->threads; threadnum++)
422            if (!queue->thread[threadnum].active)
423            {
424               osd_event_set(queue->thread[threadnum].wakeevent);
425               add_to_stat(&queue->setevents, 1);
426            }
427      }
428   }
429
430525   // only return the item if it won't get released automatically
431   return (flags & WORK_ITEM_FLAG_AUTO_RELEASE) ? NULL : item;
526   //return (flags & WORK_ITEM_FLAG_AUTO_RELEASE) ? NULL : *item_tailptr;
527   return (flags & WORK_ITEM_FLAG_AUTO_RELEASE) ? NULL : itemlist;
432528}
433529
434530
r1112r1113
439535int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout)
440536{
441537   // if we're done already, just return
442   if (item->refcount == 0)
538   if (item->done)
443539      return TRUE;
444540
445541   // if we don't have an event, create one
446542   if (item->event == NULL)
447543      item->event = osd_event_alloc(TRUE, FALSE);      // manual reset, not signalled
544   else
545       osd_event_reset(item->event);
448546
449547   // if we don't have an event, we need to spin (shouldn't ever really happen)
450   if (item->event != NULL)
548   if (item->event == NULL)
451549   {
452550      osd_ticks_t stopspin = osd_ticks() + timeout;
453      while (item->refcount != 0 && osd_ticks() < stopspin)
454         YieldProcessor();
551      while (!item->done && osd_ticks() < stopspin)
552         osd_yield_processor();
455553   }
456554
457555   // otherwise, block on the event until done
458   else if (item->refcount != 0)
556   else if (!item->done)
459557      osd_event_wait(item->event, timeout);
460558
461559   // return TRUE if the refcount actually hit 0
462   return (item->refcount == 0);
560   return item->done;
463561}
464562
465563
r1112r1113
520618{
521619   mame_thread_info *thread = param;
522620   osd_work_queue *queue = thread->queue;
523   osd_event *hlist[3];
524621
525   // fill in our handle list
526   hlist[0] = queue->workevent;
527   hlist[1] = thread->wakeevent;
528   hlist[2] = queue->exitevent;
529
530622   // loop until we exit
531623   for ( ;; )
532624   {
533625      // block waiting for work or exit
534      int result = 0;
535
536626      // bail on exit, and only wait if there are no pending items in queue
537      if (queue->items == 0)
538         result = osd_event_wait_multiple(ARRAY_LENGTH(hlist), hlist, 10000000);
539      if (result == 2)
627      if (!queue->exiting && queue->items == 0)
628      {
629         begin_timing(thread->waittime);
630         osd_event_wait(thread->wakeevent, INFINITE);
631         end_timing(thread->waittime);
632      }
633      if (queue->exiting)
540634         break;
541635
542636      // indicate that we are live
543637      thread->active = TRUE;
544      osd_sync_add(&queue->livethreads, 1);
638      osd_interlocked_increment(&queue->livethreads);
545639
546640      // process work items
547641      for ( ;; )
r1112r1113
552646         worker_thread_process(queue, thread);
553647
554648         // spin for a while looking for more work
555         stopspin = osd_ticks() + osd_ticks_per_second() / 1000;
649         begin_timing(thread->spintime);
650         stopspin = osd_ticks() + SPIN_LOOP_TIME;
556651         while (queue->items == 0 && osd_ticks() < stopspin)
557            YieldProcessor();
652            osd_yield_processor();
653         end_timing(thread->spintime);
558654
559655         // if nothing more, release the processor
560656         if (queue->items == 0)
r1112r1113
564660
565661      // decrement the live thread count
566662      thread->active = FALSE;
567      osd_sync_add(&queue->livethreads, -1);
663      osd_interlocked_decrement(&queue->livethreads);
568664   }
569   //return 0;
570665   return NULL;
571666}
572667
r1112r1113
577672
578673static void worker_thread_process(osd_work_queue *queue, mame_thread_info *thread)
579674{
675   begin_timing(thread->runtime);
676
580677   // loop until everything is processed
581678   while (queue->items != 0)
582679   {
583      int removed_item = FALSE;
584680      osd_work_item *item;
681      INT32 lockslot;
585682
586683      // use a critical section to synchronize the removal of items
587      osd_lock_acquire(queue->critsect);
684      lockslot = scalable_lock_acquire(&queue->lock);
588685      {
686         // pull the item from the queue
589687         item = (osd_work_item *)queue->list;
590688
591         // if it is a regular item, or if it is a shared item that is complete, remove it
592         if (item != NULL && (!(item->flags & WORK_ITEM_FLAG_SHARED) || item->refcount == 0))
689         if (item != NULL)
593690         {
594            removed_item = TRUE;
595691            queue->list = item->next;
596            if (item->next == NULL)
692            if (queue->list == NULL)
597693               queue->tailptr = (osd_work_item **)&queue->list;
598694         }
599695      }
600      osd_lock_release(queue->critsect);
696      scalable_lock_release(&queue->lock, lockslot);
601697
602      // call the callback and signal its event
603      if (item != NULL && item->refcount != 0)
604         execute_work_item(item);
605
606      // if we removed an item, decrement the item count and signal done if appropriate
607      if (removed_item && osd_sync_add(&queue->items, -1) == 0)
698      // process non-NULL items
699      if (item != NULL)
608700      {
609         // we don't need to set the doneevent for multi queues because they spin
610         if (!(item->flags & WORK_QUEUE_FLAG_MULTI))
611            osd_event_set(queue->doneevent);
701         // call the callback and stash the result
702         item->result = (*item->callback)(item->param);
703         osd_interlocked_decrement(&queue->items);
704         item->done = TRUE;
612705
613706         // if it's an auto-release item, release it
614707         if (item->flags & WORK_ITEM_FLAG_AUTO_RELEASE)
615708            osd_work_item_release(item);
709
710         // set the result and signal the event
711         else if (item->event != NULL)
712         {
713            osd_event_set(item->event);
714            add_to_stat(&item->queue->setevents, 1);
715         }
716
717         // if we removed an item and there's still work to do, bump the stats
718         if (queue->items != 0)
719            add_to_stat(&queue->extraitems, 1);
616720      }
617
618      // if we removed an item and there's still work to do, bump the stats
619      if (removed_item && queue->items != 0)
620         add_to_stat(&queue->extraitems, 1);
621721   }
622}
623722
624
625//============================================================
626//  execute_work_item
627//============================================================
628
629static void execute_work_item(osd_work_item *item)
630{
631   void *result;
632
633   // add a claim to this work item; if it had already been completed, back off and exit
634   if (osd_sync_add(&item->refcount, 1) == 1)
723   // we don't need to set the doneevent for multi queues because they spin
724   if (queue->waiting)
635725   {
636      item->refcount = 0;
637      return;
726      osd_event_set(queue->doneevent);
727      add_to_stat(&queue->setevents, 1);
638728   }
639729
640   // call the callback and stash the result
641   result = (*item->callback)(item->param);
642
643   // mark it complete and signal the event
644   if (osd_sync_add(&item->refcount, -1) == 1 && osd_compare_exchange32(&item->refcount, 1, 0) == 1)
645   {
646      // set the result and signal the event
647      item->result = result;
648      if (item->event != NULL)
649         osd_event_set(item->event);
650   }
730   end_timing(thread->runtime);
651731}
652732
653733#endif   // SDLMAME_WIN32

Previous 15994 Revisions Next


© 1998-2018 The MESS Team