How to kill off a pending APM operation

后端 未结 2 898
余生分开走
余生分开走 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:29

    This is not directly supported in the framework. Your best bet is to write a wrapper that spawns a thread and use synchronization primitives like events to signal a cancel request.

    HTH

    Colby Africa

提交回复
热议问题