So I created a new threading Class and now run the User_FS in a second thread. The main thread is now free to receive notifications, it is running in a run loop.
I am able to leave detachNewThread on NO, so every stuff in the Filesystem is running now in a second thread. I don´t know what detachNewThread exactly detaches into a new Thread, but it doesn't work with my setting. But with creating a second thread manually and move the Filesystem and its initializer from the main.m to the second thread, everything works fine. I'm not sure but I think I recognize some slight performance improvement and responsiveness. Mike On Jan 22, 8:28 am, mike <[email protected]> wrote: > Hi there, > > I forgot to note that when I configure the Filesystem with the > > detachNewThread:YES option, the notification works. What exactly > does GMUserFilesystem with this option? > > To my understanding, if I opt NO, all code should run in the main > thread, which should be the place, notifications would be delivered > to. > If I opt YES, UserFS would run in a new thread, which is NOT the main > thread, which should not receive notifications... > > I am not able to run the UserFS in another thread because I use an > additional framework which is not threadsave and thus, not running > well with the opt YES. > > Thanks for replies, > > Mike > > On Jan 21, 7:28 pm, Michael Ruepp <[email protected]> wrote: > > > > > Hi there, > > > my filesystem is based on the Macfuse Obj-C Command Line Filesystem > > Template. > > > I need to use NSWorkspace Notifications and NSDistributed Notification > > Center inside my User_Filesystem.m (I initialize the Observer in the > > initWithXXX Section of my User_FS like this: > > > //Notification Center for receiving mount notifications > > //theRepoHandler = [[RepoHandler alloc]init]; > > > [[[NSWorkspace sharedWorkspace] notificationCenter] > > addObserver:self selector:@selector( didMount: ) > > > > > > name:NSWorkspaceDidMountNotification object:nil]; > > [[[NSWorkspace sharedWorkspace] notificationCenter] > > addObserver:self selector:@selector( didUnmount: ) > > > > > > name:NSWorkspaceDidUnmountNotification object:nil]; > > > I created two corresponding Methods. > > > - (void)didMount:(NSNotification *)notif > > { > > ALog(@"Hey someone mounted something at %@", [[notif userInfo] > > objectForKey:@"NSDevicePath"] ); > > > } > > > - (void)didUnmount:(NSNotification *)notif > > { > > ALog(@"Hey someone unmounted something at %@", [[notif userInfo] > > objectForKey:@"NSDevicePath"] ); > > > } > > > However, I never received any notification. > > > Funny, when I use the Objective-C Filesystem (Read/Write) template, > > everything works fine. > > > Thanks a lot, > > > Mike -- You received this message because you are subscribed to the Google Groups "MacFUSE" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/macfuse?hl=en.
