Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • You win. No, really, this seems to be the shortest version, unless you encapsulate that into another function. Commented Jun 19, 2009 at 15:40
  • 16
    Thinking about this... in most applications this is fine, but in yours the console app will exit before FireAway sends anything to the console. ThreadPool threads are background threads and die when the app dies. On the other hand, using a Thread wouldn't work either as the console window would disappear before FireAway tried to write to the window. Commented Jun 19, 2009 at 15:41
  • 3
    There is no way to have a non-blocking method call that is guaranteed to run, so this is in fact the most accurate answer to the question IMO. If you need to guarantee execution then potential blocking needs to be introduced via a control structure such as AutoResetEvent (as Kev mentioned) Commented Jun 19, 2009 at 17:40
  • 2
    To run the task in a thread independent of the thread pool, I believe you could also go (new Action(FireAway)).BeginInvoke() Commented Sep 14, 2009 at 19:01
  • 3
    What about this Task.Factory.StartNew(() => myevent()); from answer stackoverflow.com/questions/14858261/… Commented Dec 28, 2014 at 17:58