Add a comment and remove an mutext unlock on error because this function is not

where the lock is acquired.
This commit is contained in:
Gregory Burd 2013-04-20 06:13:41 -04:00
parent be95229af9
commit 01a79a08c0

View file

@ -104,7 +104,10 @@ ASYNC_NIF_INIT(wterl);
/**
* Open a WT_SESSION for the thread context 'ctx' to use, also init the
* shared cursor hash table.
*
* Note: always call within enif_mutex_lock/unlock(conn_handle->contexts_mutex)
*/
static int
__init_session_and_cursor_cache(WterlConnHandle *conn_handle, WterlCtx *ctx)
@ -114,7 +117,6 @@ __init_session_and_cursor_cache(WterlConnHandle *conn_handle, WterlCtx *ctx)
int rc = conn->open_session(conn, NULL, conn_handle->session_config, &ctx->session);
if (rc != 0) {
ctx->session = NULL;
enif_mutex_unlock(conn_handle->contexts_mutex);
return rc;
}
ctx->cursors = kh_init(cursors);