]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.c
Fix race condition when calling meshlink_stop() immediately after meshlink_start().
[meshlink] / src / meshlink.c
index 1c763d6a668e632a70650d648e259c9aedb66d88..b3b18074b171c9d93b3217fcbde533b7a4a80326 100644 (file)
@@ -965,6 +965,8 @@ bool meshlink_start(meshlink_handle_t *mesh) {
 
        // Start the main thread
 
+       event_loop_start(&mesh->loop);
+
        if(pthread_create(&mesh->thread, NULL, meshlink_main_loop, mesh) != 0) {
                logger(mesh, MESHLINK_DEBUG, "Could not start thread: %s\n", strerror(errno));
                memset(&mesh->thread, 0, sizeof mesh->thread);