On Dec 21, 2012, at 10:15 AM, Cheer Xiao <xiaqq...@gmail.com> wrote: > 2012/12/19 ridiculous_fish <corydo...@ridiculousfish.com>: >> After running a command, some processing occurs on a background thread. When >> that's done, it notifies the main thread, which adds the item to the >> history. The earliest that the main thread can respond to the notification >> is in its main "event loop", which is a call to select(). So the history >> item only gets added after the next prompt is displayed. >> > > What's the motivation for using another thread for adding history?
The motivation is as follows: when storing a history item, fish tries to detect which arguments are valid file paths, and then only autosuggests the command if those paths remain valid. For example, if you run "cat fish.cpp" in the fish source directory, fish will notice that 'fish.cpp' is a valid path. If you go to another directory, it won't autosuggest that command, unless a fish.cpp happens to be in that directory too. Checking whether an argument is a valid path requires disk I/O that may be slow (think NFS server), so it's done in a background thread. History is saved synchronously on the main thread. The history file lives in your home directory, and home directories are typically fast to access, so it's not as important to make that asynchronous. (However it would be nice to make it so.) Hope that helps, _fish ------------------------------------------------------------------------------ Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 _______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users