Project Description
a new procedural programming framework based on .net, by using lambda expression, it can handle async io friendly and provide a full lock-free solution

this project is hoping to help people who are working on async io with callback / IAsyncResult or troubling with multi-threading and lock, etc.
the newly designed pattern uses lambda expression to handle the async io, high-performance multi-threading, lock-free programming, timeout together.

you will need it if you are in the following status,
1. cannot handle lock well, or stuck in a deadlock
2. hate to write async code, since it's not pretty and hard to write / debug
3. hit by a performance issue
4. need to have several extra threads to handle some regular jobs
5. though .net 4.5 support await, but you need to write everything await to make them work e2e, you cannot control where to sync, where to async

briefly you can write async code like this,
dim ec as event_comb = nothing
return new event_comb(
function() as boolean
return waitfor(an_event_comb_lock) andalso goto_next()
end function,
function() as boolean
ec = some_other_async_io_operation()
return waitfor(ec, timeout_ms) andalso goto_next()
end function,
function() as boolean
return ec.end_result() andalso goto_end()
end function)

and start the event_comb with

then you will not need to warry about any async io operation, and more.

currently the procedure have supported
1. event_comb w/ timeout control
2. extensions for some async io classes, such as stream, httplistener, to help create an event_comb
3. waitfor another event_comb, or a set of event_combs
4. waitfor a sync io operation if it's not supported <say File.Move>
5. waitfor a certain time, surely not block any thread
6. event_comb_lock, which is a cross-thread lock, make everything else lock-free
7. waitfor a singleentry
8. control the step based on several goto commands

since the event_comb and procedure based programming model is pretty coupled with other components in osi project,, so i will leave a non-compilable version in the source code, and a workable version in download. i will also update the source / binary here, but for the latest code and update, please refer to geminibranch project.
to use the procedure based programming model, you need to refer osi.root.procedure.dll into your project, and run osi.root.utt.exe event_comb_* to make sure you have got a good build. and register_slimqless2_threadpool for a better performance.
the default build is against .net 3.5, but i have also added a build-with-4.0.cmd into geminibranch/osi, and finished all the test pass on surface rt <surely you need a jail broken version>, except for several performance cases. so if you need some specific .net version, enlist the code and build from scratch is a good way. after the build, run osi.root.utt.exe * from osi/utt/bin/release | debug to verify basic functionalities.

enjoy, my pleasure if any can help you.

non-commercial use only

thank you

any questions, feel free to drop me a msg to

Last edited Jun 14, 2013 at 4:05 AM by Hzj_jie, version 10