[SR-Users] Difference between shared and script variable

Daniel-Constantin Mierla miconda at gmail.com
Thu Feb 21 09:20:23 CET 2013


Hello,

On 2/19/13 11:41 PM, Mino Haluz wrote:
> Thank you very much for this.
>
> One question regarding $sht. Does it need locking like $shv does?
depends what operation you do. A read does not need locking, a write 
does not need, but updates that uses itself need.

Cheers,
Daniel

>
>
> On Thu, Feb 14, 2013 at 8:35 AM, Daniel-Constantin Mierla 
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
>     Hello,
>
>     $shv(...) is referred as shared memory variable because it stores
>     the value in shared memory. That means if you set $shv(x) in one
>     process, you can read its value from another process. You have to
>     be sure you don't have races in setting the variable, that could
>     be achieved with locks from cfgutils.
>
>     $var(...) is referred as private memory variable because it stores
>     the value in private memory. That means its value is valid in the
>     context of the same process (e.g., use it while processing the
>     same sip message on a single routing block type, like running the
>     main request route block, or reply route block, etc). It is not
>     safe to use it for transactions, like setting it in request route
>     block and reading it in failure route block (use avps for that case).
>
>     $var(...) is faster to use and does not need locking at all. These
>     are usually referred as script variable, but this term can be
>     confused with all the config file variables.
>
>     Cheers,
>     Daniel
>
>
>     On 2/12/13 3:13 PM, Mino Haluz wrote:
>>     Hi,
>>
>>     what is the difference between shared and script variable ? Thanks
>>
>>     Mino
>>
>>
>>     _______________________________________________
>>     SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>     sr-users at lists.sip-router.org  <mailto:sr-users at lists.sip-router.org>
>>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>     -- 
>     Daniel-Constantin Mierla -http://www.asipto.com
>     http://twitter.com/#!/miconda  <http://twitter.com/#%21/miconda>  -http://www.linkedin.com/in/miconda
>     Kamailio World Conference, April 16-17, 2013, Berlin
>       -http://conference.kamailio.com  -
>
>
>     _______________________________________________
>     SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
>     list
>     sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>
>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, April 16-17, 2013, Berlin
  - http://conference.kamailio.com -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130221/0449e354/attachment.htm>


More information about the sr-users mailing list