[收藏]IOCP Thread Pooling in C#[11]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 zhengyun_ustc 的 blog

    [dllimport("kernel32", charset=charset.auto)]

    private unsafe static extern boolean closehandle(uint32 hobject);

 

    /// <summary> win32func: posts a context based event into an io completion port thread pool </summary>

    [dllimport("kernel32", charset=charset.auto)]

    private unsafe static extern boolean postqueuedcompletionstatus(uint32 hcompletionport, uint32 uisizeofargument, uint32* puiuserarg, overlapped* poverlapped);

 

    /// <summary> win32func: waits on a context based event from an io completion port thread pool.

    ///           all threads in the pool wait in this win32 function </summary>

    [dllimport("kernel32", charset=charset.auto)]

    private unsafe static extern boolean getqueuedcompletionstatus(uint32 hcompletionport, uint32* psizeofargument, uint32* puiuserarg, overlapped** ppoverlapped, uint32 uimilliseconds);

 

the next section is the constants section.  here we need to define the win32 constants required for the win32 api calls we are going to make later.

 

  // constants

 

    /// <summary> simtypeconst: this represents the win32 invalid handle value macro </summary>

    private const uint32 invalid_handle_value = 0xffffffff;

 

    /// <summary> simtypeconst: this represents the win32 infinite macro </summary>

    private const uint32 inifinite = 0xffffffff;

 

    /// <summary> simtypeconst: this tells the iocp function to shutdown </summary>

    private const int32 shutdown_iocpthread = 0x7fffffff;

 

本文关键:[收藏]IOCP Thread Pooling in C#
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top