I'll take a stab at it and suggest that the sleep is not sleeping the thread but in fact your entire process which makes it non-responsive until it is scheduled to run again. From memory you should be able to make a blocking I/O call and FUSE will handle the rest - which is effectively what is happening because you can't finish your call without having the data so you might as well just block for what you need until you get it.
Cheers, Sam Moffatt http://pasamio.id.au On Sun, Mar 13, 2011 at 1:54 AM, Mike Abraham <[email protected]> wrote: > This surely a newbie question, so my apologies in advance. I'm > creating a loopback file system that temporarily blocks on read events > while transfering data from a remote location. > > To give my background process a little time to fetch the data, I sleep > the current thread. However, doing so seems to block all operations in > the VFS -- it essentially behaves as if it is single-threaded. > > It's easy to reproduce this in either the straight C, or Objective-C > loopback examples. Using the Obj-C example, just insert the following > lines in the readFileAtPath() method, right after the pread call, as > follows: > > int ret = pread(fd, buffer, size, offset); > > NSLog(@"Sleeping for 10 seconds."); > [NSThread sleepForTimeInterval:10]; > > If you run this and then try to open 2 different files, you'll see > that the second file cannot be read until the read on the first file > returns. > > My obvious question is, is this normal, and if so, how do I deal with > it, keeping in mind that I will need to block on read in some fashion > while spinning up my process to grab data remotely. > > Thanks in advance for any assistance. -- 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. > > -- 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.
