Skip to content

Commit 744f1af

Browse files
nyaxtjustincase
authored andcommitted
no gvl mysql_stmt_store_result
1 parent ec36692 commit 744f1af

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ext/mysql2/statement.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ static void *nogvl_execute(void *ptr) {
130130
}
131131
}
132132

133+
static void *nogvl_stmt_store_result(void *ptr) {
134+
MYSQL_STMT *stmt = ptr;
135+
136+
if(mysql_stmt_store_result(stmt)) {
137+
return (void *)Qfalse;
138+
} else {
139+
return (void *)Qtrue;
140+
}
141+
}
142+
133143
#define FREE_BINDS \
134144
for (i = 0; i < argc; i++) { \
135145
if (bind_buffers[i].buffer && NIL_P(params_enc[i])) { \
@@ -295,8 +305,8 @@ static VALUE execute(int argc, VALUE *argv, VALUE self) {
295305
if(is_streaming) {
296306
rb_raise(cMysql2Error, "TODO: streaming stmt execute not yet impl.");
297307
} else {
298-
// recieve the whole result set from ther server
299-
if (mysql_stmt_store_result(stmt)) {
308+
// recieve the whole result set from the server
309+
if (rb_thread_call_without_gvl(nogvl_stmt_store_result, stmt, RUBY_UBF_IO, 0) == Qfalse) {
300310
rb_raise(cMysql2Error, "%s", mysql_stmt_error(stmt));
301311
}
302312
MARK_CONN_INACTIVE(stmt_wrapper->client);

0 commit comments

Comments
 (0)