Hi again,
I have another question regarding thread safe programming in Pike.
If you have a global object m and that several threads can write to m->foo (where foo is a public variable of this object), then do you need to protect access to m->foo or the entire m object ?
Is it the same if it is a mapping ?
You don't need to protect anything at all for pikes sake; all data types are thread safe. The mutexes are only necessary to avoid races on the pike level in your application.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-09-12 00:33: Subject: Mutex protection
Hi again,
I have another question regarding thread safe programming in Pike.
If you have a global object m and that several threads can write to m->foo (where foo is a public variable of this object), then do you need to protect access to m->foo or the entire m object ?
Is it the same if it is a mapping ?
-- David Gourdelier
/ Brevbäraren
Thank you.
FYI I added this to http://caudium.net/developer/pikeref/ex/predef_3A_3A/Thread/Mutex.html since it's quite usefull to know this.
Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
You don't need to protect anything at all for pikes sake; all data types are thread safe. The mutexes are only necessary to avoid races on the pike level in your application.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-09-12 00:33: Subject: Mutex protection
Hi again,
I have another question regarding thread safe programming in Pike.
If you have a global object m and that several threads can write to m->foo (where foo is a public variable of this object), then do you need to protect access to m->foo or the entire m object ?
Is it the same if it is a mapping ?
-- David Gourdelier
/ Brevbäraren
Is a patch wanted for the official pike-docs?
/ Peter Lundqvist (disjunkt)
Previous text:
2003-09-12 16:31: Subject: Re: Mutex protection
Thank you.
FYI I added this to http://caudium.net/developer/pikeref/ex/predef_3A_3A/Thread/Mutex.html since it's quite usefull to know this.
Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
You don't need to protect anything at all for pikes sake; all data types are thread safe. The mutexes are only necessary to avoid races on the pike level in your application.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-09-12 00:33: Subject: Mutex protection
Hi again,
I have another question regarding thread safe programming in Pike.
If you have a global object m and that several threads can write to m->foo (where foo is a public variable of this object), then do you need to protect access to m->foo or the entire m object ?
Is it the same if it is a mapping ?
-- David Gourdelier
/ Brevbäraren
/ Brevbäraren
pike-devel@lists.lysator.liu.se