|
From: Csaba H. <csa...@cr...> - 2006-06-07 22:20:34
|
On 2006-06-07, Remy Blank <rem...@po...> wrote: > Csaba Henk wrote: >> - You don't call pthread_detach(3). According to sshfs and the manpage, >> it seems that it should indeed be called after the pthread_create() >> call. > > I disagree with that one. pthread_detach() puts the thread in > non-joinable state, and makes it cleanup automatically on exit. However, > I call pthread_join() in fuse_stop_idle_monitor_thread() to do the > cleanup, and with your patch it fails (you can check its return value, > it will always be nonzero). Detaching is necessary in sshfs because it > doesn't call pthread_join() when the main loop exits. > > I prefer the solution using pthread_join(). That way, I am sure that the > thread has exited when fuse_stop_idle_monitor_thread() returns. Thanks for the explanation. I never used pthreads by myself, I just guessed based on sshfs. (Given this, I hope the "should" above didn't sound too categoric :)) > I attached a patch that replaces your second patch, with the following > minor fixes: > > - Removed the call to pthread_detach(). > > - Don't display mountpoint when trying to unmount. This doesn't really > add any value, especially on BSD if the mountpoint is not always present. > > - Update idle_monitor.last_activity when trying to unmount, as a failed > attempt should be considered as activity. At this point your contribution looks pretty good to me. Regards, Csaba |