Permalink
Browse files

Merge branch 'fix'

Conflicts:
	c_src/erlzmq_nif.c
  • Loading branch information...
2 parents ec60b1d + b7d36bb commit 6fc00dcbe03531c6e7dda3eaa012e5851fc895ca @evax evax committed Apr 18, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 c_src/erlzmq_nif.c
View
@@ -922,6 +922,7 @@ static void * polling_thread(void * handle)
else if (r->type == ERLZMQ_THREAD_REQUEST_TERM) {
enif_mutex_lock(context->mutex);
free(context->thread_socket_name);
+ // use this to flag context is over
context->thread_socket_name = NULL;
enif_mutex_unlock(context->mutex);
// cleanup pending requests
@@ -946,6 +947,8 @@ static void * polling_thread(void * handle)
zmq_close(context->thread_socket);
enif_mutex_unlock(context->mutex);
zmq_term(context->context_zmq);
+ enif_mutex_lock(context->mutex);
+ enif_mutex_unlock(context->mutex);
enif_mutex_destroy(context->mutex);
enif_release_resource(context);
// notify the waiting request

0 comments on commit 6fc00dc

Please sign in to comment.