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 4271484
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:26:55+00:00 2026-05-21T07:26:55+00:00

Reading the VS2008 help file I’ve figured out that the clean way of exiting

  • 0

Reading the VS2008 help file I’ve figured out that the clean way of exiting a thread (in .net) is either by using a return statement (in C#) or letting the thread reach the end of the method.

However, I have not found a method or property that would allow me to set the thread’s exit code nor a way to retrieve it (as it is done using the Win32 API). Therefore, the question is, how do I do this using C# and .net ?

Thank you for your help,

John.

  • 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-05-21T07:26:56+00:00Added an answer on May 21, 2026 at 7:26 am

    The reason the underlying Win32 thread primitives aren’t exposed is to prevent managed code from relying on them. The CLR team is always working on ways to optimize thread usage, and that includes no guarantees about 1:1 managed:unmanaged thread mapping (see “Note” on this MSDN page, for instance). If you really want to do it anyway, you’ll need to set up P/Invoke wrappers that use an unmanaged thread handle from Win32 GetCurrentThread(), or hook into the thread mapping process yourself with a custom host. I wouldn’t recommend either, unless you absolutely have to interop with something that uses thread exit codes and isn’t managed code-aware. Figure out another way to smuggle state info around if you can do it all managed (or use Task Parallel Library to abstract up a level from bare threads).

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

Sidebar

Related Questions

currently I am having sucsess with reading the excel file with my c# ,net
OK so we have something that is currently using OpenExeConfiguration for reading a config
I remember reading somewhere about multiproc builds in VS2008, only I can't find the
Given I'm: a solo developer using VS2008 Professional looking for Microsoft-produced source control (I'm
I'm working on WinForm app in VS2008, I have a sql table that is
Reading about the GitHub wikis, I saw that they support several lightweight markup languages
//Reading data from property file : String username = prop.getProperty(username); String password = prop.getProperty(password);
Reading this article I thougth automatic property work on .NET Framework 3.0, but some
I've just installed VS2008 Express Edition. I'm still reading the What's new section. I
I have a problem with reading a bunch of files using the following C#

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.