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 » Core multithread dangers
Re: Core multithread dangers [message #843 is a reply to message #836] Sat, 04 February 2006 14:53 Go to previous messageGo to previous message
hojtsy is currently offline  hojtsy
Messages: 241
Registered: January 2006
Location: Budapest, Hungary
Experienced Member
luzr wrote on Fri, 03 February 2006 17:51

Also, note that StaticCriticalSection is zero-initilized POD, so it does not perform any further form of initilization (nice simple solution to "how to serialize initialization of serializer").
Yes, that is a very good idea. But I needed almost an hour Shocked to figure out how that works before you posted it - it was quite tricky. Even a short code comment would have saved me lots of time.

I think this new macro is not threadsafe:
#define ONCELOCK \
for(static volatile bool b = true; b;) \
	for(static CriticalSection section; b;) \
		for(CriticalSection::Lock lock(section); b; b = false)
The problem is that the b flag is not protected from repeated default-initialization to true.

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Next Topic: SlaveProcess should be moved from Web to Core
Goto Forum:
  


Current Time: Thu May 16 09:27:07 CEST 2024

Total time taken to generate the page: 0.02421 seconds