This project has moved. For the latest updates, please go here.

Who has samples for using Nito Asynchronous Library ?

May 8, 2009 at 2:12 PM

Who has samples for using Nito Asynchronous Library ?

May 8, 2009 at 6:14 PM

Some of the higher-level Nito.Async classes use the lower-level ones (AsyncTimeoutTimer uses GenericSynchronizingObject; Timer uses CallbackContext).

The Nito.Async.Sockets library (which is included as part of Nito.Async) uses objects from Nito.Async to implement asynchronous socket components, and they have their own sample code on another project:

There aren't any official code samples currently for ActionDispatcher. This is all that's currently available:

I've worked hard at providing unambiguous API documentation, though there isn't any actual sample code currently in the docs. If you have any questions about any of the APIs, just post them here.


P.S. I'm currently prioritizing the roadmap for v2.0. Items on the docket include actual components (that would go into the Toolbox), a proper publisher policy assembly (so the strong-named versions are correctly declared backwards-compatible), an actual installer, and some minor updates to the socket protocol class. Sample code is on the list, but pretty far down. Would you view this as a higher-priority item; and if so, should sample code be in the docs or their own solution files?

Jun 25, 2009 at 4:54 PM

I'm searching some examples, too...

I'm using Nito.Async and TCP Server/client example and all works smoothly, but I have some troubles trying to do something by myself.
Now I'm tryng to use ActionDispatcher; I'm working on a plugin-extendable application, and my target is fire-up dinamically a plugin, enqueue some Actions in it and then call Run() method, expecting that these Actions would be processed by a secondary dedicated thread. Unfortunately, this don't seems to work: I misurderstood ActionDispatcher use?
How can I do what i need using Nito.Async library?

It would be nice if you can provide a little example for doing this kind of work, using Nito.Async instead BackgroudWorkers or raw .NET Threading.

Thank you! :-)

Jun 25, 2009 at 8:45 PM

The quick answer: ActionDispatcher is used for queueing actions to another thread, but it does not provide a thread of its own. You have to create an explicit foreground or background thread by using Thread and calling Thread.Start(). The child thread delegate then calls ActionDispatcher.Run(). ActionDispatcher may also work with BackgroundWorker if ActionDispatcher.Run is invoked by BackgroundWorker.DoWork.

The longer answer: The next version is a major update (2.0). One class that is being considered is an ActionDispatcherThread which would act more like what you expected. The documentation generation has also been overhauled, a new build system has been developed, publisher policy files have been added, and the source control system has been migrated. I'm also trying to develop some unit tests (though unit testing this kind of library is excessively difficult). Actual sample code has been tagged a must-have for the next release. The sample code will be in both the documentation and separate solutions, and the separate TCP server/client example (currently on the other MS code site) will become part of Nito.Async at that release.

Nito.Async 2.0 still has quite a ways to go before it's ready. I would expect a release in mid-August. Possibly a few weeks sonner, but that's what I'm officially shooting for.


Jun 26, 2009 at 12:02 PM

Ok, it's clear (a deeper look at code was enough to undestand...).
Thank you, I'll stay tuned for 2.0 release! :-)

Aug 22, 2009 at 3:32 AM

+1 I'm also looking for examples.

 I think some actual examples would be very helpful.


Sep 23, 2009 at 10:22 AM

Examples for the more commonly-used classes (except socket classes) have been added to the Version 1.4 release, since it was decided to release v2.0 after .NET 4.0.