Skip to content

Commit 94040be

Browse files
committed
subsys/fs/fuse: Avoid possible race
Avoid a possible race between the FUSE thread and the Zephyr threads during init. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
1 parent 0db06bc commit 94040be

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

subsys/fs/fuse_fs_access_bottom.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -615,15 +615,15 @@ void ffsa_init_bottom(const char *fuse_mountpoint, struct ffa_op_callbacks *op_c
615615
nsi_print_error_and_exit("%s is not a directory\n", fuse_mountpoint);
616616
}
617617

618-
err = pthread_create(&fuse_thread, NULL, ffsa_main, (void *)fuse_mountpoint);
619-
if (err < 0) {
620-
nsi_print_error_and_exit("Failed to create thread for fuse_fs_access_main\n");
621-
}
622-
623618
err = sem_init(&op_queue.op_done, 0, 0);
624619
if (err) {
625620
nsi_print_error_and_exit("Failed to initialize semaphore\n");
626621
}
622+
623+
err = pthread_create(&fuse_thread, NULL, ffsa_main, (void *)fuse_mountpoint);
624+
if (err < 0) {
625+
nsi_print_error_and_exit("Failed to create thread for fuse_fs_access_main\n");
626+
}
627627
}
628628

629629
void ffsa_cleanup_bottom(const char *fuse_mountpoint)

0 commit comments

Comments
 (0)