diff options
author | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-01-20 10:51:11 +0100 |
---|---|---|
committer | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-01-20 10:51:11 +0100 |
commit | e09c80f273ea5d682f633309c4c512bff3e59bbd (patch) | |
tree | 110c5f3e50631bb68781e9cd72490c4413d0261d | |
parent | 48e375d31897056b3ab62106ba84552fd554f1c8 (diff) | |
download | lanes-e09c80f273ea5d682f633309c4c512bff3e59bbd.tar.gz lanes-e09c80f273ea5d682f633309c4c512bff3e59bbd.tar.bz2 lanes-e09c80f273ea5d682f633309c4c512bff3e59bbd.zip |
get()/set() improvements
* bumped version to 3.8.0
* linda:set() accepts multiple values to set in the specified slot
* linda:get() accepts an optional count to peek several values at once
* nil values are now converted just as in send()/receive()
-rw-r--r-- | index.html | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -70,7 +70,7 @@ | |||
70 | </p> | 70 | </p> |
71 | 71 | ||
72 | <p> | 72 | <p> |
73 | This document was revised on 16-Jan-14, and applies to version <tt>3.7.8</tt>. | 73 | This document was revised on 20-Jan-14, and applies to version <tt>3.8.0</tt>. |
74 | </p> | 74 | </p> |
75 | </font> | 75 | </font> |
76 | </center> | 76 | </center> |
@@ -1068,23 +1068,31 @@ | |||
1068 | </p> | 1068 | </p> |
1069 | 1069 | ||
1070 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1070 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
1071 | [true] = linda_h:set( key, [val]) | 1071 | [bool] = linda_h:set( key [, val [, ...]]) |
1072 | 1072 | ||
1073 | [val] = linda_h:get( key) | 1073 | [val [, ...]] = linda_h:get( key [, count = 1]) |
1074 | </pre></td></tr></table> | 1074 | </pre></td></tr></table> |
1075 | 1075 | ||
1076 | <p> | 1076 | <p> |
1077 | The table access methods are for accessing a slot without queuing or consuming. They can be used for making shared tables of storage among the lanes. | 1077 | The table access methods are for accessing a slot without queuing or consuming. They can be used for making shared tables of storage among the lanes. |
1078 | <br/> | ||
1079 | Writing to a slot never blocks because it ignores the limit. It overwrites existing value and clears any possible queued entries. | ||
1080 | <br/> | ||
1081 | Reading doesn't block either because <tt>get()</tt> returns whatever is available (which can be nothing), up to the specified count. | ||
1082 | <br/> | ||
1083 | Table access and <tt>send()</tt>/<tt>receive()</tt> can be used together; reading a slot essentially peeks the next outcoming value of a queue. | ||
1078 | </p> | 1084 | </p> |
1079 | 1085 | ||
1080 | <p> | 1086 | <p> |
1081 | Writing to a slot never blocks because it ignores the limit. It overwrites existing value and clears any possible queued entries. | 1087 | <tt>set()</tt> signals the linda for write if a value is stored. |
1082 | <br/> | 1088 | <br/> |
1083 | <tt>set()</tt> signals the linda from write if a value is stored. | 1089 | (Since version 3.7.7) if the key was full but the new data count of the key after <tt>set()</tt> is below its limit, <tt>set()</tt> returns <tt>true</tt> and the linda is also signaled for read so that send()-blocked threads are awakened. |
1084 | <br/> | 1090 | </p> |
1085 | (Since version 3.7.7) if the key was full but the new data count of the key after <tt>set()</tt> is below its limit, <tt>set()</tt> returns <tt>true</tt> and the linda is also signaled for read so that send()-blocked threads are awakened. | 1091 | |
1092 | <p> | ||
1093 | Since version 3.8.0, <tt>set()</tt> can write several values at the specified key, writing <tt>nil</tt> values is now possible, and clearing the contents at the specified key is done by not providing any value. | ||
1086 | <br/> | 1094 | <br/> |
1087 | Table access and <tt>send()</tt>/<tt>receive()</tt> can be used together; reading a slot essentially peeks the next outcoming value of a queue. | 1095 | Also, <tt>get()</tt> can read several values at once. If the key contains no data, <tt>get()</tt> returns no value. This can be used to separate the case when reading stored <tt>nil</tt> values. |
1088 | </p> | 1096 | </p> |
1089 | 1097 | ||
1090 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1098 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |