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   |
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 ), 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
|
|
|
 |
|
ARM threadind does not work
By: Didier on Sat, 15 December 2012 11:00
|
 |
|
Re: ARM threadind does not work
By: Didier on Sat, 15 December 2012 18:16
|
 |
|
Re: ARM threadind does not work
By: Didier on Sat, 15 December 2012 22:20
|
 |
|
Re: ARM threadind does not work
By: Didier on Tue, 18 December 2012 21:46
|
 |
|
Re: ARM threadind does not work
By: mirek on Fri, 28 December 2012 11:59
|
 |
|
Re: ARM threadind does not work
By: Didier on Fri, 28 December 2012 14:40
|
 |
|
Re: ARM threadind does not work
By: Novo on Mon, 31 December 2012 07:16
|
 |
|
Re: ARM threadind does not work
By: Didier on Mon, 31 December 2012 12:09
|
 |
|
Re: ARM threadind does not work
By: Zbych on Mon, 31 December 2012 12:42
|
 |
|
Re: ARM threadind does not work
By: Didier on Tue, 01 January 2013 10:55
|
Goto Forum:
Current Time: Wed Aug 27 11:52:17 CEST 2025
Total time taken to generate the page: 0.07095 seconds
|