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 #38608 is a reply to message #38607] Fri, 28 December 2012 14:40 Go to previous messageGo to previous message
Didier is currently offline  Didier
Messages: 736
Registered: November 2008
Location: France
Contributor
Hy Mirek,

Quote:

First of all, static variables are by definition initialized to zero.


While this is true when compiling in debug mode, it is not true with all compilers when compiled with O2 or O3 so I'm used to not counting on the default init of variables

Quote:

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.

For me static vars are initialised a exe startup (before app starts) and if there could be a race condition then the code can not work properlly ( see pthread man and the reason of pthread_once_t existence )


Quote:

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.

That's what i also thought when first ran into the bug (so when I saw the inititalisation problem, I thought I had solutionned the problem ... but that was not the case Sad ), but after some reading and trying pthread_once_t the issue was corrected.

I agree that this bug has to find a valid correction (my pacth only deals with one use of StaticMutex ... there are others.

I didn't try to debug the internals for now (lack of time).
I'll try to do it next week.

[Updated on: Fri, 28 December 2012 14:46]

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 11:52:17 CEST 2025

Total time taken to generate the page: 0.07095 seconds