Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:57:44+00:00 2026-06-09T12:57:44+00:00

I vaguely recall that WinAPI provided something called APC which allowed you to instruct

  • 0

I vaguely recall that WinAPI provided something called APC which allowed you to instruct a thread to execute a function on your behalf and it would do so, as soon as it found the time to do it. The thread would not need to wait on a signal but the kernel maintained the APC queue for it and instructed the thread to execute the items in the queue.

I did some research how this would be done in .NET but so far I have not found a way to do this. I know about BeginInvoke but this is only applicable in the context of UI controls, I believe?

How would I go about doing this in the .NET environment?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:57:45+00:00Added an answer on June 9, 2026 at 12:57 pm

    This is exposed somewhat in .NET, in the very specific case of APCs being used for I/O completion callbacks. Which is a very common use for APCs. It is quite low-level, as APCs are, a core method is ThreadPool.BindHandle() which sets up the plumbing to allow the callback to execute managed code on a threadpool thread. Making the calls to start the overlapped I/O is however not, that’s up to you to pinvoke. This is otherwise already ably wrapped by the various classes that perform I/O and their BeginXxxx() methods, like FileStream, PipeStream, Socket, etcetera.

    Next thing you need for your own APCs is putting a thread in an alertable wait-state, equivalent to WaitForSingleObjectEx() with a TRUE value for the bAlertable argument. That’s heavily wrapped by the CLR, it has a big stake in the alertable state for waits since that matters a great deal whether or not managed threads can be safely aborted. Afaik, all waits that you call in managed code are alertable, including methods like Thread.Join() and Thread.Sleep(). Ignore the bool argument named “exitContext” in the WaitHandle.WaitXxx overloads, that means something else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I vaguely recall being able to do something like this in Python: cat foo
I recall a quote that goes something like this: Unix is the universal virtual
I vaguely remember learning about some sort of built-in function that would do the
I vaguely remember that it was possible to write something like: void f(int a,
I vaguely remember some sort of setuptools wrapper that would generate .egg files from
I'm developing an app that is vaguely similar to twitter, in that it allows
I vaguely recall seeing this before in an answer to another question, but searching
I vaguely learned how regex work earlier on my last question and thought that
I vaguely remember reading somewhere (in MSDN ODBC documentation?) that one application cannot make
The docs vaguely say that it will stick around as long as needed, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.