summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/windows/winwork.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/windows/winwork.c')
-rw-r--r--src/osd/windows/winwork.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/src/osd/windows/winwork.c b/src/osd/windows/winwork.c
index 5bfa1ebd2ae..250f9700840 100644
--- a/src/osd/windows/winwork.c
+++ b/src/osd/windows/winwork.c
@@ -59,8 +59,8 @@
// DEBUGGING
//============================================================
-#define KEEP_STATISTICS (0)
-#define USE_SCALABLE_LOCKS (0)
+#define KEEP_STATISTICS (0)
+#define USE_SCALABLE_LOCKS (0)
@@ -68,7 +68,7 @@
// PARAMETERS
//============================================================
-#define SPIN_LOOP_TIME (osd_ticks_per_second() / 1000)
+#define SPIN_LOOP_TIME (osd_ticks_per_second() / 1000)
@@ -77,13 +77,13 @@
//============================================================
#if KEEP_STATISTICS
-#define add_to_stat(v,x) do { atomic_add32((v), (x)); } while (0)
-#define begin_timing(v) do { (v) -= get_profile_ticks(); } while (0)
-#define end_timing(v) do { (v) += get_profile_ticks(); } while (0)
+#define add_to_stat(v,x) do { atomic_add32((v), (x)); } while (0)
+#define begin_timing(v) do { (v) -= get_profile_ticks(); } while (0)
+#define end_timing(v) do { (v) += get_profile_ticks(); } while (0)
#else
-#define add_to_stat(v,x) do { } while (0)
-#define begin_timing(v) do { } while (0)
-#define end_timing(v) do { } while (0)
+#define add_to_stat(v,x) do { } while (0)
+#define begin_timing(v) do { } while (0)
+#define end_timing(v) do { } while (0)
#endif
#ifndef YieldProcessor
@@ -109,69 +109,69 @@ INLINE void YieldProcessor(void)
struct scalable_lock
{
#if USE_SCALABLE_LOCKS
- struct
- {
- volatile INT32 haslock; // do we have the lock?
- INT32 filler[64/4-1]; // assumes a 64-byte cache line
- } slot[WORK_MAX_THREADS]; // one slot per thread
- volatile INT32 nextindex; // index of next slot to use
+ struct
+ {
+ volatile INT32 haslock; // do we have the lock?
+ INT32 filler[64/4-1]; // assumes a 64-byte cache line
+ } slot[WORK_MAX_THREADS]; // one slot per thread
+ volatile INT32 nextindex; // index of next slot to use
#else
- CRITICAL_SECTION section;
+ CRITICAL_SECTION section;
#endif
};
struct work_thread_info
{
- osd_work_queue * queue; // pointer back to the queue
- HANDLE handle; // handle to the thread
- HANDLE wakeevent; // wake event for the thread
- volatile INT32 active; // are we actively processing work?
+ osd_work_queue * queue; // pointer back to the queue
+ HANDLE handle; // handle to the thread
+ HANDLE wakeevent; // wake event for the thread
+ volatile INT32 active; // are we actively processing work?
#if KEEP_STATISTICS
- INT32 itemsdone;
- osd_ticks_t actruntime;
- osd_ticks_t runtime;
- osd_ticks_t spintime;
- osd_ticks_t waittime;
+ INT32 itemsdone;
+ osd_ticks_t actruntime;
+ osd_ticks_t runtime;
+ osd_ticks_t spintime;
+ osd_ticks_t waittime;
#endif
};
struct osd_work_queue
{
- scalable_lock lock; // lock for protecting the queue
- osd_work_item * volatile list; // list of items in the queue
- osd_work_item ** volatile tailptr; // pointer to the tail pointer of work items in the queue
- osd_work_item * volatile free; // free list of work items
- volatile INT32 items; // items in the queue
- volatile INT32 livethreads; // number of live threads
- volatile INT32 waiting; // is someone waiting on the queue to complete?
- volatile UINT8 exiting; // should the threads exit on their next opportunity?
- UINT32 threads; // number of threads in this queue
- UINT32 flags; // creation flags
- work_thread_info * thread; // array of thread information
- HANDLE doneevent; // event signalled when work is complete
+ scalable_lock lock; // lock for protecting the queue
+ osd_work_item * volatile list; // list of items in the queue
+ osd_work_item ** volatile tailptr; // pointer to the tail pointer of work items in the queue
+ osd_work_item * volatile free; // free list of work items
+ volatile INT32 items; // items in the queue
+ volatile INT32 livethreads; // number of live threads
+ volatile INT32 waiting; // is someone waiting on the queue to complete?
+ volatile UINT8 exiting; // should the threads exit on their next opportunity?
+ UINT32 threads; // number of threads in this queue
+ UINT32 flags; // creation flags
+ work_thread_info * thread; // array of thread information
+ HANDLE doneevent; // event signalled when work is complete
#if KEEP_STATISTICS
- volatile INT32 itemsqueued; // total items queued
- volatile INT32 setevents; // number of times we called SetEvent
- volatile INT32 extraitems; // how many extra items we got after the first in the queue loop
- volatile INT32 spinloops; // how many times spinning bought us more items
+ volatile INT32 itemsqueued; // total items queued
+ volatile INT32 setevents; // number of times we called SetEvent
+ volatile INT32 extraitems; // how many extra items we got after the first in the queue loop
+ volatile INT32 spinloops; // how many times spinning bought us more items
#endif
};
struct osd_work_item
{
- osd_work_item * next; // pointer to next item
- osd_work_queue * queue; // pointer back to the owning queue
- osd_work_callback callback; // callback function
- void * param; // callback parameter
- void * result; // callback result
- HANDLE event; // event signalled when complete
- UINT32 flags; // creation flags
- volatile INT32 done; // is the item done?
+ osd_work_item * next; // pointer to next item
+ osd_work_queue * queue; // pointer back to the owning queue
+ osd_work_callback callback; // callback function
+ void * param; // callback parameter
+ void * result; // callback result
+ HANDLE event; // event signalled when complete
+ UINT32 flags; // creation flags
+ volatile INT32 done; // is the item done?
};
//============================================================
@@ -267,7 +267,7 @@ osd_work_queue *osd_work_queue_alloc(int flags)
queue->flags = flags;
// allocate events for the queue
- queue->doneevent = CreateEvent(NULL, TRUE, TRUE, NULL); // manual reset, signalled
+ queue->doneevent = CreateEvent(NULL, TRUE, TRUE, NULL); // manual reset, signalled
if (queue->doneevent == NULL)
goto error;
@@ -307,7 +307,7 @@ osd_work_queue *osd_work_queue_alloc(int flags)
thread->queue = queue;
// create the per-thread wake event
- thread->wakeevent = CreateEvent(NULL, FALSE, FALSE, NULL); // auto-reset, not signalled
+ thread->wakeevent = CreateEvent(NULL, FALSE, FALSE, NULL); // auto-reset, not signalled
if (thread->wakeevent == NULL)
goto error;
@@ -598,7 +598,7 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout)
// if we don't have an event, create one
if (item->event == NULL)
- item->event = CreateEvent(NULL, TRUE, FALSE, NULL); // manual reset, not signalled
+ item->event = CreateEvent(NULL, TRUE, FALSE, NULL); // manual reset, not signalled
else
ResetEvent(item->event);