Correct bad GVL ifdefs

This commit is contained in:
Struma 2022-07-05 04:21:03 -04:00
parent 8f018fdb30
commit 0f8a140dec

View file

@ -34,7 +34,7 @@
#include "intern.h" #include "intern.h"
#endif #endif
#if RAPI_MAJOR > 2 #if RAPI_MAJOR >= 2
#include <ruby/thread.h> #include <ruby/thread.h>
#endif #endif
@ -74,7 +74,7 @@ static VALUE fileIntForPath(const char *path, bool rubyExc) {
return obj; return obj;
} }
#if RAPI_MAJOR > 2 #if RAPI_MAJOR >= 2
typedef struct { typedef struct {
SDL_RWops *ops; SDL_RWops *ops;
void *dst; void *dst;
@ -114,13 +114,13 @@ RB_METHOD(fileIntRead) {
#if RAPI_MAJOR > 2 #if RAPI_MAJOR >= 2
fileIntReadCbArgs cbargs {ops, RSTRING_PTR(data), length}; fileIntReadCbArgs cbargs {ops, RSTRING_PTR(data), length};
rb_thread_call_without_gvl([](void* args) -> void* { rb_thread_call_without_gvl([](void* args) -> void* {
call_RWread_cb((fileIntReadCbArgs*)args); call_RWread_cb((fileIntReadCbArgs*)args);
return 0; return 0;
}, (void*)&cbargs, 0, 0); }, (void*)&cbargs, 0, 0);
#elif #else
SDL_RWread(ops, RSTRING_PTR(data), 1, length); SDL_RWread(ops, RSTRING_PTR(data), 1, length);
#endif #endif