Click here to Skip to main content
15,896,528 members
Articles / Programming Languages / C#

NParallel, A Small Parallel Execution Library

Rate me:
Please Sign up or sign in to vote.
4.06/5 (30 votes)
19 Dec 2007CPOL9 min read 69.1K   606   60  
A Simple Library which allows you to write asynchronous code easily, almost in a synchronous pattern.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@                                                                                                               @
@                                       NParallel Library Readme                                                @
@                                                                                                               @
@                                         authored by Leaf(lifuwei@gmail.com)                                   @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
0: Version updates
	v0.001.2007.07_27_17.38 TEE engine framework done, tested with basic cases.
							DSM framework partially designed.
							Working on Monitors and ReaderWriterLock
1: Modules
	TEE : Task Execution Engine
		The multithreaded dispatcher, used to parallel jobs.
		The current designed pragma is like ;
	
		NPOperations.Execute<int> // library entry
            (
                delegate // Parallel Task block
                {
					// codes within this block will be considered a unit
                    return Program.GetResult(99 , 88);
                },

                Calculate	// specify a callback method, can left this with blank
                , NMarshal.Manual   // Manually join the result back, this is especially useful for UI threads.
									// Can also choose NMarshal.Auto
            );
            
		NResult<int> result3 = NPOperations.Execute<int>( // declared a result holder, which will be used when value is needed for the method.
                delegate
                {
                    return Program.GetResult(3000, 2000); // async code block
                }
            );
            
        result3.Value // this will cause the thread to block for the value.    
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
China China
Leaf is a software developer based in ShangHai China.
My major programming languages are C#/C++.
I am very interested in distributed system design and rich client development.
Current I am working on NParallel.

Comments and Discussions