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 » ARM threadind does not work
Re: ARM threadind does not work [message #38607 is a reply to message #38461] Fri, 28 December 2012 11:59 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
This is all somewhat weird.

static Mutex& sMutexLock()
{
	static Mutex *section;
	if(!section) {
		static byte b[sizeof(Mutex)];
		section = new(b) Mutex;
	}
	return *section;
}

INITBLOCK {
	sMutexLock();
}


First of all, static variables are by definition initialized to zero. Putting " = 0" IMO can result in creating race condition, as the setting this explicit zero might be postponed to the time sMutexLock is called for the first time.

Anyway, all of that is sort of irrelevant: As you can see, INITBLOCK should ensure that sMutexLock is called at least once before APP_MAIN starts, ergo it should be already initialized when the first thread has chance screw things up.

I would recommend placing some LOGs into the INITBLOCK, then into sMutexLock and at the start of APP_MAIN to find out what is really going on... (it is quite possible that INITBLOCK does not work as we wish, in that case it would be very good to know that in order to find some workarounds, as we depend on it a lot)

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: TcpSocket issues on XP but not on Win7?
Next Topic: Redirect - possibly another Skylark bug
Goto Forum:
  


Current Time: Wed Aug 27 11:55:09 CEST 2025

Total time taken to generate the page: 0.06330 seconds