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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:38:57+00:00 2026-06-04T12:38:57+00:00

i.e. when I start a new thread, is it safe to read any variables

  • 0

i.e. when I start a new thread, is it safe to read any variables initialized before the thread start from the newly started thread?

UPD why I’m asking? Because some developers assume that it does have, and don’t use any explicit memory barriers there. And I couldn’t reproduce any bugs in that code. However, documentation http://msdn.microsoft.com/en-us/library/ms686355(v=vs.85).aspx doesn’t say this is safe.

  • 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-04T12:38:59+00:00Added an answer on June 4, 2026 at 12:38 pm

    Yes, the operating system provides the implicit barrier. It can’t get the thread started without taking an internal lock that protects the thread scheduler data structures.

    Which isn’t explicitly promised that I know of. Since .NET 2.0, there is no longer a direct correspondence between a Thread and a ProcessThread. This link was broken at the request of the SQL Server team that wanted to implement a Thread with a fiber. This did not actually happen, they gave up on the project when they couldn’t make it reliable enough. Given the outcome of this project and no mainstream project I know of that has ever tried to take advantage of this again, as well as the difficulty of implementing Thread support that doesn’t use a lock, I’d say it is safe to assume you can rely on the implicit barrier.

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

Sidebar

Related Questions

I want to start a new thread using a C function, not an objective-C
Is it possible start a new thread within an Async task? Something like this:
If i use thread like this: void foo() { new Thread().Start(); } since the
Given the code: new Thread(new BackgroundWorker()).start(); Intuitively it feels like the BackgroundWorker instance should
I have a listener: listener = new HttpListener(); listener.Prefixes.Add(@http://+:8077/); listener.Start(); listenerThread = new Thread(HandleRequests);
I need to implement simple thread-safe memory management preventing fragmentation. I've read some articles
I will start new PDA project on the windows mobile and compact framework 2.0
Is it a good idea to start new test framework using Selenium web driver
I know that we can start new activity with the steps as follows :
All M-x egg- commands work ok M-x egg-start-new-branch start new branch with name: xxx

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.