EldoS | Feel safer!

Software components for data protection, secure storage and transfer

.Net example of worker threads in callbacks?

Posted: 03/24/2015 17:33:39
by John Hoerr (Standard support level)
Joined: 10/22/2013
Posts: 4

At the end of the 'Getting Started with Callback File System' document (https://www.eldos.com/cbfs/articles/5335.php) there is the following note about asynchronous operations:

If allowed by file system implementation design, try to cache the file system operations in memory and perform all disk, GUI and network operations asynchronously, i.e. in a separate worker thread and not in the callback handler.

Is there a .Net-based example of how this can best be accomplished? Unfortunately the async/await pattern introduced in .Net 4.5 can't be used with many of the callbacks because they include 'ref' parameters in the method signature (e.g. OnWriteFile, OnReadFile, OnOnGetFileInfo, OnEnumerateDirectory). Any guidance would be appreciated. Thanks!
Posted: 03/25/2015 00:20:19
by Eugene Mayevski (Team)

The quote means read-aheads (and post-writes accordingly), i.e. you can read and cache the data before the files and directories are accessed, and then use the read information in callbacks.

The callback itself can not be asynchronous because indeed your code is required to provide the requested information. So if you hoped to postpone the operation and not handle it, then, sorry, this is not possible.

Sincerely yours
Eugene Mayevski
Posted: 03/25/2015 01:56:45
by Eugene Mayevski (Team)

There's also an explanation available in the FAQ.

Sincerely yours
Eugene Mayevski



Topic viewed 2214 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!