Home » U++ Library support » U++ MT-multithreading and servers » Use same variable in different threads
Re: Use same variable in different threads [message #30459 is a reply to message #30350] |
Sun, 02 January 2011 15:35 |
|
mirek wrote on Sat, 25 December 2010 21:45 | ScopedLock is in U++ as Mutex::Lock.
For read/write access, please notice RWMutex (multiple readers, just one writer). It has 'scoped' RWMutex::ReadLock and RWMutex::WriteLock variants.
As for Atomic variables, its basic feature is that they can accessed and perform increments/decrements from multiple threads WITHOUT caring about mutexes or barriers.
|
Mirek,
You read my mind. RWMutex seems to be perfect.
Windows variant I see
1. a limitation: only LONG_MAX concurrent reads can be. if concurrent reads > LONG_MAX then result is undefined.
Linux variant is a kernel variant. I didn't found the source code and can't say the opinion.
2. If write in recursive mode by the same phread will wait to infinitely.
The linux version is more pretty realized according by this links source code:
http://www.jbox.dk/sanos/source/include/pthread.h.html
http://www.jbox.dk/sanos/source/lib/pthread/rwlock.c.html
|
|
|
|
|
Use same variable in different threads
By: koldo on Thu, 09 December 2010 18:26
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
By: koldo on Thu, 09 December 2010 22:04
|
|
|
Re: Use same variable in different threads
By: Didier on Fri, 10 December 2010 00:26
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
By: koldo on Fri, 10 December 2010 10:01
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
By: koldo on Fri, 10 December 2010 13:19
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
By: Didier on Fri, 10 December 2010 18:50
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
By: Didier on Sat, 11 December 2010 23:13
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
By: mirek on Sun, 12 December 2010 09:43
|
|
|
Re: Use same variable in different threads
By: koldo on Sun, 12 December 2010 23:16
|
|
|
Re: Use same variable in different threads
By: tojocky on Mon, 13 December 2010 11:35
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
By: Didier on Mon, 13 December 2010 22:48
|
|
|
Re: Use same variable in different threads
By: koldo on Tue, 14 December 2010 09:02
|
|
|
Re: Use same variable in different threads
By: mirek on Sat, 25 December 2010 20:45
|
|
|
Re: Use same variable in different threads
By: tojocky on Sun, 02 January 2011 15:35
|
|
|
Re: Use same variable in different threads
By: mirek on Sun, 02 January 2011 18:38
|
|
|
Re: Use same variable in different threads
By: koldo on Sun, 02 January 2011 19:06
|
|
|
Re: Use same variable in different threads
By: mirek on Sun, 02 January 2011 22:56
|
|
|
Re: Use same variable in different threads
By: koldo on Mon, 03 January 2011 09:17
|
|
|
Re: Use same variable in different threads
By: koldo on Sun, 02 January 2011 01:12
|
|
|
Re: Use same variable in different threads
|
|
|
Re: Use same variable in different threads
By: Didier on Sun, 02 January 2011 12:18
|
|
|
Re: Use same variable in different threads
|
Goto Forum:
Current Time: Thu May 09 14:55:12 CEST 2024
Total time taken to generate the page: 0.02313 seconds
|