]> git.meshlink.io Git - meshlink/commitdiff
Remove extra locks causing deadlocks for wait_sync_flag function
authorSS Roop <sairoop@elear.solutions>
Mon, 18 Mar 2019 07:01:01 +0000 (12:31 +0530)
committerGuus Sliepen <guus@meshlink.io>
Mon, 18 Mar 2019 20:25:37 +0000 (21:25 +0100)
test/channels-cornercases.c
test/utils.c

index ba4843d8672b4a65be456b58a357f931ccd2ff44..90762bc55566fe7ca4bee604f546e6262006e130 100644 (file)
@@ -109,7 +109,6 @@ int main() {
        assert(nb);
 
        struct sync_flag channel_opened = {.flag = false};
        assert(nb);
 
        struct sync_flag channel_opened = {.flag = false};
-       pthread_mutex_lock(&channel_opened.mutex);
 
        meshlink_channel_t *channel = meshlink_channel_open(a, nb, 7, a_receive_cb, NULL, 0);
        assert(channel);
 
        meshlink_channel_t *channel = meshlink_channel_open(a, nb, 7, a_receive_cb, NULL, 0);
        assert(channel);
index 4cafa4b452a9300b19d86c6fcace767ecefe2288..a2b7b143972991d824ad23b9922860172f279921 100644 (file)
@@ -87,15 +87,11 @@ void start_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b) {
        a->priv = &pair_status;
        meshlink_set_node_status_cb(a, pair_status_cb);
 
        a->priv = &pair_status;
        meshlink_set_node_status_cb(a, pair_status_cb);
 
-       pthread_mutex_lock(&pair_status.mutex);
-
        meshlink_start(a);
        meshlink_start(b);
 
        assert(wait_sync_flag(&pair_status, 5));
 
        meshlink_start(a);
        meshlink_start(b);
 
        assert(wait_sync_flag(&pair_status, 5));
 
-       pthread_mutex_unlock(&pair_status.mutex);
-
        meshlink_set_node_status_cb(a, NULL);
        a->priv = NULL;
 }
        meshlink_set_node_status_cb(a, NULL);
        a->priv = NULL;
 }