Added cache line size info in SDL_cpuinfo.h
I also added an implementation to dynamically query it, but didn't expose it since most x86 CPUs have an L1 cache line size of 64 bytes.
This commit is contained in:
parent
1d518f0d73
commit
fb824f9a04
4 changed files with 121 additions and 67 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "SDL_timer.h"
|
||||
#include "SDL_timer_c.h"
|
||||
#include "SDL_atomic.h"
|
||||
#include "SDL_cpuinfo.h"
|
||||
#include "SDL_thread.h"
|
||||
|
||||
/* #define DEBUG_TIMERS */
|
||||
|
@ -46,9 +47,6 @@ typedef struct _SDL_TimerMap
|
|||
struct _SDL_TimerMap *next;
|
||||
} SDL_TimerMap;
|
||||
|
||||
/* A reasonable guess */
|
||||
#define CACHELINE_SIZE 128
|
||||
|
||||
/* The timers are kept in a sorted list */
|
||||
typedef struct {
|
||||
/* Data used by the main thread */
|
||||
|
@ -58,7 +56,7 @@ typedef struct {
|
|||
SDL_mutex *timermap_lock;
|
||||
|
||||
/* Padding to separate cache lines between threads */
|
||||
char pad[CACHELINE_SIZE];
|
||||
char cache_pad[SDL_CACHELINE_SIZE];
|
||||
|
||||
/* Data used to communicate with the timer thread */
|
||||
SDL_SpinLock lock;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue