static void rb_mysql_client_free(void * ptr) { mysql_client_wrapper *wrapper = (mysql_client_wrapper *)ptr; nogvl_close(wrapper); free(ptr); }
void decr_mysql2_client(mysql_client_wrapper *wrapper) { wrapper->refcount--; if (wrapper->refcount == 0) { #ifndef _WIN32 if (wrapper->connected && !wrapper->automatic_close) { /* The client is being garbage collected while connected. Prevent * mysql_close() from sending a mysql-QUIT or from calling shutdown() on * the socket by invalidating it. invalidate_fd() will drop this * process's reference to the socket only, while a QUIT or shutdown() * would render the underlying connection unusable, interrupting other * processes which share this object across a fork(). */ if (invalidate_fd(wrapper->client->net.fd) == Qfalse) { fprintf(stderr, "[WARN] mysql2 failed to invalidate FD safely\n"); close(wrapper->client->net.fd); } } #endif nogvl_close(wrapper); xfree(wrapper); } }
void decr_mysql2_client(mysql_client_wrapper *wrapper) { wrapper->refcount--; if (wrapper->refcount == 0) { nogvl_close(wrapper); xfree(wrapper->client); xfree(wrapper); } }
static void rb_mysql_client_free(void *ptr) { mysql_client_wrapper *wrapper = (mysql_client_wrapper *)ptr; wrapper->refcount--; if (wrapper->refcount == 0) { nogvl_close(wrapper); xfree(wrapper->client); xfree(wrapper); } }
static void rb_rados_cluster_free(void * ptr) { rados_cluster_wrapper *wrapper = (rados_cluster_wrapper *)ptr; nogvl_close(wrapper); xfree(ptr); }