Skip to content

Commit

Permalink
sockem: fix thread join regression
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhill committed Mar 12, 2019
1 parent 01ab9d3 commit 73295a7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tests/sockem.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ typedef pthread_mutex_t mtx_t;
typedef pthread_t thrd_t;
#define thrd_create(THRD,START_ROUTINE,ARG) \
pthread_create(THRD, NULL, START_ROUTINE, ARG)
#define thrd_join(THRD,RETVAL) \
pthread_join(THRD, (void *)RETVAL)
#define thrd_join0(THRD) \
pthread_join(THRD, NULL)


static mtx_t sockem_lock;
Expand Down Expand Up @@ -640,8 +640,6 @@ static void sockem_bufs_purge (sockem_t *skm) {


void sockem_close (sockem_t *skm) {
int res;

mtx_lock(&sockem_lock);
mtx_lock(&skm->lock);
if (skm->linked)
Expand All @@ -658,7 +656,7 @@ void sockem_close (sockem_t *skm) {

mtx_unlock(&skm->lock);

thrd_join(skm->thrd, &res);
thrd_join0(skm->thrd);

sockem_bufs_purge(skm);

Expand Down

0 comments on commit 73295a7

Please sign in to comment.