Does setting $shv()s in script require lock()ing, or is it inherently thread-safe?
Thanks!
For what kind of operation?
Reading or setting the value are safe, but updating it with its own value used in an expression is not.
Safe:
xlog("value is $sht(x)\n"); $sht(x) = 1;
Race:
$sht(x) = $sht(x) + 1;
Cheers, Daniel
On 19/11/14 00:27, Alex Balashov wrote:
Does setting $shv()s in script require lock()ing, or is it inherently thread-safe?
Thanks!
Thanks, it was actually increment I was interested in.
Can one get around it with an intermediate variable?
$var(y) = $shv(x); $shv(x) = $var(y) + 1;
I would just use a lock(), but I'm afraid that it will serialise message processing too much at high volume, due to the blocking.
On 19 November 2014 01:23:14 GMT-05:00, Daniel-Constantin Mierla miconda@gmail.com wrote:
For what kind of operation?
Reading or setting the value are safe, but updating it with its own value used in an expression is not.
Safe:
xlog("value is $sht(x)\n"); $sht(x) = 1;
Race:
$sht(x) = $sht(x) + 1;
Cheers, Daniel
On 19/11/14 00:27, Alex Balashov wrote:
Does setting $shv()s in script require lock()ing, or is it inherently thread-safe?
Thanks!
-- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio Advanced Training, Nov 24-27, Berlin - http://www.asipto.com
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Sent from my Nexus 10, with all the figments of autocorrect that might imply.
Alex Balashov - Principal Evariste Systems LLC 235 E Ponce de Leon Ave Suite 106 Decatur, GA 30030 United States Tel: +1-678-954-0670 Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
It shouldn't ... Based on how many workers and cores you have, the probability of having collisions should be pretty low. You can process more then the minimum of workers/cores available on your server.
Regards, Ovidiu Sas
On Wed, Nov 19, 2014 at 11:21 AM, Alex Balashov abalashov@evaristesys.com wrote:
Thanks, it was actually increment I was interested in.
Can one get around it with an intermediate variable?
$var(y) = $shv(x); $shv(x) = $var(y) + 1;
I would just use a lock(), but I'm afraid that it will serialise message processing too much at high volume, due to the blocking.
On 19 November 2014 01:23:14 GMT-05:00, Daniel-Constantin Mierla miconda@gmail.com wrote:
For what kind of operation?
Reading or setting the value are safe, but updating it with its own value used in an expression is not.
Safe:
xlog("value is $sht(x)\n"); $sht(x) = 1;
Race:
$sht(x) = $sht(x) + 1;
Cheers, Daniel
On 19/11/14 00:27, Alex Balashov wrote:
Does setting $shv()s in script require lock()ing, or is it inherently thread-safe?
Thanks!
-- Sent from my Nexus 10, with all the figments of autocorrect that might imply.
Alex Balashov - Principal Evariste Systems LLC 235 E Ponce de Leon Ave Suite 106 Decatur, GA 30030 United States Tel: +1-678-954-0670 Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
s/You can process/You can't process
Typo :)
-ovidiu
On Wed, Nov 19, 2014 at 11:35 AM, Ovidiu Sas osas@voipembedded.com wrote:
It shouldn't ... Based on how many workers and cores you have, the probability of having collisions should be pretty low. You can process more then the minimum of workers/cores available on your server.
Regards, Ovidiu Sas
On Wed, Nov 19, 2014 at 11:21 AM, Alex Balashov abalashov@evaristesys.com wrote:
Thanks, it was actually increment I was interested in.
Can one get around it with an intermediate variable?
$var(y) = $shv(x); $shv(x) = $var(y) + 1;
I would just use a lock(), but I'm afraid that it will serialise message processing too much at high volume, due to the blocking.
On 19 November 2014 01:23:14 GMT-05:00, Daniel-Constantin Mierla miconda@gmail.com wrote:
For what kind of operation?
Reading or setting the value are safe, but updating it with its own value used in an expression is not.
Safe:
xlog("value is $sht(x)\n"); $sht(x) = 1;
Race:
$sht(x) = $sht(x) + 1;
Cheers, Daniel
On 19/11/14 00:27, Alex Balashov wrote:
Does setting $shv()s in script require lock()ing, or is it inherently thread-safe?
Thanks!
-- Sent from my Nexus 10, with all the figments of autocorrect that might imply.
Alex Balashov - Principal Evariste Systems LLC 235 E Ponce de Leon Ave Suite 106 Decatur, GA 30030 United States Tel: +1-678-954-0670 Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- VoIP Embedded, Inc. http://www.voipembedded.com
On 11/19/2014 11:35 AM, Ovidiu Sas wrote:
It shouldn't ... Based on how many workers and cores you have, the probability of having collisions should be pretty low. You can process more then the minimum of workers/cores available on your server.
Yeah, I know. As I've remarked before, I find throughput to reach diminishing returns when I increase children= beyond $(cat /proc/cpuinfo | grep '^proc' | wc -l).
-- Alex