Is it possible to requeue a task when using the threadpool I/O API?

loop123123 1 Reputation point
2023-02-08T20:58:31.39+00:00

When using Windows' current threadpool I/O API -- i.e., CreateThreadpoolIo, StartThreadpoolIo, etc. -- is there any way to requeue a task?

For example, if you're using ReadDirectoryChangesW, and you need to access one of the files changed, but it's temporarily locked, you might want to requeue the task so that you can try again later. Is there a way to do that using the API?

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,820 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,746 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 11,181 Reputation points Microsoft External Staff
    2023-02-09T03:15:15.6366667+00:00

    Hello,

    Welcome to Microsoft Q&A!

    As far as I'm concerned, there is no suitable api to requeue the task. You could try to cancel I/O requests that are slow or blocked. And then it is allowed to make the call again with the new parameters, without terminating the application. I suggest you could refer to the Doc: Canceling Pending I/O Operations.

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.