Click here to Skip to main content
15,885,767 members
Articles / Programming Languages / C#

Managed I/O Completion Ports (IOCP)

Rate me:
Please Sign up or sign in to vote.
4.92/5 (76 votes)
26 Apr 200621 min read 418.3K   5.3K   259  
A fully managed .NET implementation of Win32 IOCP's waitable event queuing mechanism.
using System;

using Sonic.Net.DataStructures.LockFree;

namespace Sonic.Net.ThreadPoolTaskFramework
{
	/// <summary>
	/// Factory class for creating Generic Task objects. It mantains a pool
	/// of Generic Task objects.
	/// </summary>
	public abstract class GenericTaskFactory : TaskFactory
	{
		#region Public Constructor(s)
		
		/// <summary>
		/// Default constructor
		/// </summary>
		public GenericTaskFactory()
		{
			// No-Op
		}

		#endregion

		#region Public Methods

		/// <summary>
		/// Creates a new Generic Task object .or. get an available Generic Task
		/// object from the object pool maintained by this instance of the
		/// Generic Task Factory.
		/// </summary>
		/// <param name="obj">User object that need to be associated with the new Generic Task instance</param>
		/// <returns>New Generic Task object</returns>
		public GenericTask NewGenericTask(object id,object obj)
		{
			GenericTask task = _objTaskPool.GetObject() as GenericTask;
			task.InitializeTask(id,obj,this);
			return task;
		}

		#endregion
	}
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect
India India
Software Professional with 14+ Years of experience in design & development of server products using Microsoft Technologies.

Woked/Working on server side product development using Managed C++ & C#, including Thread pools, Asynchronous Procedure Calls (APC), Inter Process Communication (IPC) using named pipes, Lock Free data structures in C++ & .Net, etc.

Comments and Discussions