Use atomic functions where appropriate
Also, rename atomic functions to be consistent with the rest of the platform/threading functions, and move atomic functions to threading* files rather than platform* files
This commit is contained in:
@@ -241,5 +241,5 @@ struct graphics_subsystem {
|
||||
DARRAY(struct vec2) texverts[16];
|
||||
|
||||
pthread_mutex_t mutex;
|
||||
volatile int ref;
|
||||
volatile long ref;
|
||||
};
|
||||
|
@@ -179,13 +179,13 @@ void gs_entercontext(graphics_t graphics)
|
||||
thread_graphics = graphics;
|
||||
}
|
||||
|
||||
graphics->ref++;
|
||||
os_atomic_inc_long(&graphics->ref);
|
||||
}
|
||||
|
||||
void gs_leavecontext(void)
|
||||
{
|
||||
if (thread_graphics) {
|
||||
if (!--thread_graphics->ref) {
|
||||
if (!os_atomic_dec_long(&thread_graphics->ref)) {
|
||||
graphics_t graphics = thread_graphics;
|
||||
|
||||
graphics->exports.device_leavecontext(graphics->device);
|
||||
|
Reference in New Issue
Block a user