Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » StaticMutex/ONCELOCK question
Re: StaticMutex/ONCELOCK question [message #19984 is a reply to message #19940] Sun, 08 February 2009 03:09 Go to previous message
Novo is currently offline  Novo
Messages: 1430
Registered: December 2006
Ultimate Contributor
Novo wrote on Tue, 03 February 2009 14:28


What I do not understand is how uninitialized o_b_ works.

{
   static volatile bool o_b_;
   if(!ReadWithBarrier(o_b_)) {
       ...
   }
}





I finally figured out that myself. ANSI-compatible compiler initializes all static POD data with zeroes before a very first function call. So, this static variable is always initialized in a thread-safe way.

There is always something to learn about C.


Regards,
Novo
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Previous Topic: HTTP Agent & WebSSL memory leak
Next Topic: Thread calls GUI
Goto Forum:
  


Current Time: Sat Jul 05 15:14:03 CEST 2025

Total time taken to generate the page: 0.02980 seconds