Home » U++ Library support » U++ MT-multithreading and servers » MT/Locking Questions
Re: MT/Locking Questions [message #15599 is a reply to message #15591] |
Wed, 30 April 2008 10:51 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
mr_ped wrote on Tue, 29 April 2008 15:49 | I bet this info is nowhere in Docs, isn't it?
(didn't find it trough Search on this site: "Mutex -forum")
Edit:
So if I understand you correctly, as long as I don't USE the Mutex in init block, I can freely use "static Mutex some_lock;", right?
If I am sure it will be initialized before I will try to use it, i.e. I will use it only outside of ctors after the application is started, that is.
|
Unfortunately, not.
At least, you cannot use it in function body. The problem is that static initialization itself is NOT MT safe.
So e.g.
void Fn()
{
static Mutex x;
}
would make Fn require external locking, because two threads might race when checking that flag used to implement static initialization.
Mirek
P.S.: Oh I guess you have in fact covered this issue in your post....
[Updated on: Wed, 30 April 2008 10:58] Report message to a moderator
|
|
|
|
|
MT/Locking Questions
By: captainc on Mon, 28 April 2008 15:23
|
|
|
Re: MT/Locking Questions
By: mirek on Mon, 28 April 2008 19:41
|
|
|
Re: MT/Locking Questions
By: captainc on Mon, 28 April 2008 20:00
|
|
|
Re: MT/Locking Questions
By: mr_ped on Mon, 28 April 2008 20:57
|
|
|
Re: MT/Locking Questions
By: captainc on Mon, 28 April 2008 22:10
|
|
|
Re: MT/Locking Questions
By: mr_ped on Tue, 29 April 2008 10:03
|
|
|
Re: MT/Locking Questions
By: mirek on Tue, 29 April 2008 19:09
|
|
|
Re: MT/Locking Questions
By: mr_ped on Tue, 29 April 2008 21:49
|
|
|
Re: MT/Locking Questions
By: mirek on Wed, 30 April 2008 10:51
|
|
|
Re: MT/Locking Questions
By: mr_ped on Wed, 30 April 2008 16:04
|
|
|
Re: MT/Locking Questions
By: mirek on Wed, 30 April 2008 21:05
|
Goto Forum:
Current Time: Thu Mar 28 13:10:02 CET 2024
Total time taken to generate the page: 0.01184 seconds
|