Skip to content

Commit a535271

Browse files
authored
Add support for safe offload of nogvl code. (#89)
1 parent e445cf3 commit a535271

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/zlib/zlib.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,11 @@ zstream_unblock_func(void *ptr)
10421042
args->interrupt = 1;
10431043
}
10441044

1045+
#ifndef RB_NOGVL_OFFLOAD_SAFE
1046+
// Default to no-op if it's not defined:
1047+
#define RB_NOGVL_OFFLOAD_SAFE 0
1048+
#endif
1049+
10451050
static VALUE
10461051
zstream_run_once_begin(VALUE _arguments)
10471052
{
@@ -1053,7 +1058,7 @@ zstream_run_once_begin(VALUE _arguments)
10531058
#ifndef RB_NOGVL_UBF_ASYNC_SAFE
10541059
return (VALUE)rb_thread_call_without_gvl(zstream_run_once, (void *)arguments, zstream_unblock_func, (void *)arguments);
10551060
#else
1056-
return (VALUE)rb_nogvl(zstream_run_once, (void *)arguments, zstream_unblock_func, (void *)arguments, RB_NOGVL_UBF_ASYNC_SAFE);
1061+
return (VALUE)rb_nogvl(zstream_run_once, (void *)arguments, zstream_unblock_func, (void *)arguments, RB_NOGVL_UBF_ASYNC_SAFE | RB_NOGVL_OFFLOAD_SAFE);
10571062
#endif
10581063
}
10591064

0 commit comments

Comments
 (0)