How to kill off a pending APM operation

后端 未结 2 956
余生分开走
余生分开走 2021-01-15 01:27

If you have a pending operation, eg

stream.BeginRead(_buffer, 0, _buffer.Length, _asyncCallbackRead, this);

and you close the stream provi

2条回答
  •  生来不讨喜
    2021-01-15 01:34

    [Inspired by the chapter on APM in Richter's CLR via C# I decided to see what goodies SO had on the subject and I found this question. I thought Peter had a great question here and did a bit of research -- this is the result]

    Jeffrey Richter in CLR via C# (chapter 27) discusses his AsyncEnumerator class which (supposedly) takes much of the pain away from programming the APM. One of the features of this class (part of his freely available Power Threading Libary) is the ability to cancel asynchronous operations.

    The class can be downloaded from the link above. The page also includes a link to a Yahoo Group Richter set up to provided limited support for the lib.

    He introduces the library in these MSDN articles:

    Simplified APM With The AsyncEnumerator
    More AsyncEnumerator Features

提交回复
热议问题