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 #38443 is a reply to message #38440] Sat, 15 December 2012 22:20 Go to previous messageGo to previous message
Didier is currently offline  Didier
Messages: 736
Registered: November 2008
Location: France
Contributor
Ok, I found a correction,

The correction only shows where the problem is: incorrect management of 'sMutexLock' initialization by several threads at the same time
A clean correction is still to be found : I think a refactoring of StaticMutex will be necessary for this (the correction is only valid for POSIX systems)

This is not the first time Upp stumbles on the same problem : there is another case stated on the forum:
http://www.ultimatepp.org/forum/index.php?t=msg&goto=159 98&&srch=sMutexLock#msg_15998


Core/Mt.cpp L14

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

AFTER
static Mutex *_sMutexLock_section=0;
static void _sMutexLock()
{
	if(!_sMutexLock_section) {
		static byte b[sizeof(Mutex)];
		_sMutexLock_section = new(b) Mutex;
	}
}

static Mutex& sMutexLock()
{
	static pthread_once_t sMutexLock_is_initialized = PTHREAD_ONCE_INIT;
    (void) pthread_once(&sMutexLock_is_initialized, _sMutexLock);
	return *_sMutexLock_section;
}

[Updated on: Sat, 15 December 2012 22:25]

Report message to a moderator

 
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 18:44:15 CEST 2025

Total time taken to generate the page: 0.06339 seconds