Execute NIF calls on non-scheduler threads asynchronously #6

Merged
gburd merged 72 commits from gsb-async-nifs3 into master 2013-04-23 00:54:56 +00:00
5 changed files with 9 additions and 9 deletions
Showing only changes of commit 15a9a70c41 - Show all commits

View file

@ -96,7 +96,7 @@ struct async_nif_state {
return enif_make_tuple2(env, enif_make_atom(env, "error"), \
enif_make_atom(env, "enomem")); \
} \
bzero(req, sizeof(struct async_nif_req_entry)); \
memset(req, 0, sizeof(struct async_nif_req_entry)); \
copy_of_args = (struct decl ## _args *)enif_alloc(sizeof(struct decl ## _args)); \
if (!copy_of_args) { \
fn_post_ ## decl (args); \
@ -278,7 +278,7 @@ async_nif_unload(ErlNifEnv *env)
async_nif->req_count--;
}
}
bzero(async_nif, sizeof(struct async_nif_state));
memset(async_nif, 0, sizeof(struct async_nif_state));
enif_free(async_nif);
}
@ -301,7 +301,7 @@ async_nif_load(void)
async_nif = enif_alloc(sizeof(struct async_nif_state));
if (!async_nif)
return NULL;
bzero(async_nif, sizeof(struct async_nif_state));
memset(async_nif, 0, sizeof(struct async_nif_state));
async_nif->num_queues = info.scheduler_threads;
async_nif->next_q = 0;
@ -316,7 +316,7 @@ async_nif_load(void)
}
/* Setup the thread pool management. */
bzero(async_nif->worker_entries, sizeof(struct async_nif_worker_entry) * ASYNC_NIF_MAX_WORKERS);
memset(async_nif->worker_entries, 0, sizeof(struct async_nif_worker_entry) * ASYNC_NIF_MAX_WORKERS);
/* Start the worker threads. */
//unsigned int num_workers = ASYNC_NIF_MAX_WORKERS - (ASYNC_NIF_MAX_WORKERS % async_nif->num_queues);
@ -348,7 +348,7 @@ async_nif_load(void)
enif_thread_join(async_nif->worker_entries[i].tid, &exit_value);
}
bzero(async_nif->worker_entries, sizeof(struct async_nif_worker_entry) * ASYNC_NIF_MAX_WORKERS);
memset(async_nif->worker_entries, 0, sizeof(struct async_nif_worker_entry) * ASYNC_NIF_MAX_WORKERS);
return NULL;
}
}

View file

@ -28,9 +28,9 @@ case "$1" in
./autogen.sh)
fi
(cd wiredtiger/build_posix && \
CFLAGS="-I/usr/local/include -L/usr/local/lib" \
../configure --with-pic \
--enable-snappy \
--enable-bzip2 \
--prefix=${BASEDIR}/system && \
make -j && make install)
[ -d ${BASEDIR}/../priv ] || mkdir ${BASEDIR}/../priv

BIN
c_src/bzip2-1.0.6.tar.gz Normal file

Binary file not shown.

BIN
c_src/snappy-1.0.4.tar.gz Normal file

Binary file not shown.

View file

@ -138,7 +138,7 @@ __close_all_sessions(WterlConnHandle *conn_handle)
}
kh_destroy(cursors, h);
session->close(session, NULL);
bzero(&conn_handle->contexts[i], sizeof(WterlCtx));
memset(&conn_handle->contexts[i], 0, sizeof(WterlCtx));
}
}
conn_handle->num_contexts = 0;
@ -297,7 +297,7 @@ ASYNC_NIF_DECL(
}
conn_handle->conn = conn;
conn_handle->num_contexts = 0;
bzero(conn_handle->contexts, sizeof(WterlCtx) * ASYNC_NIF_MAX_WORKERS);
memset(conn_handle->contexts, 0, sizeof(WterlCtx) * ASYNC_NIF_MAX_WORKERS);
conn_handle->context_mutex = enif_mutex_create(NULL);
ERL_NIF_TERM result = enif_make_resource(env, conn_handle);
enif_release_resource(conn_handle);