diff options
author | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-01-09 12:07:41 +0100 |
---|---|---|
committer | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-01-09 12:07:41 +0100 |
commit | 3741cb9dbc367b6438ecc1d117b3e108ac93163e (patch) | |
tree | 2ed81f1542bf8cdee36829bbae1c46a7c4af1d33 | |
parent | 85e0f90e1eb46f468bcb0edef7ef45c655131e5f (diff) | |
download | lanes-3741cb9dbc367b6438ecc1d117b3e108ac93163e.tar.gz lanes-3741cb9dbc367b6438ecc1d117b3e108ac93163e.tar.bz2 lanes-3741cb9dbc367b6438ecc1d117b3e108ac93163e.zip |
Linda fixes
* bumped version to 3.7.7
* fix crash when calling linda:count() on unknown keys
* purge key storage with linda:set( key, nil) on an unlimited key to
reduce memory usage with lots of keys
* linda:limit() wakes write-blocked threads if necessary when the new
limit enables writes to occur again
* linda:set() wakes write-blocked threads if necessary if the operation
created some room to write into
-rw-r--r-- | index.html | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -70,7 +70,7 @@ | |||
70 | </p> | 70 | </p> |
71 | 71 | ||
72 | <p> | 72 | <p> |
73 | This document was revised on 06-Jan-14, and applies to version <tt>3.7.6</tt>. | 73 | This document was revised on 09-Jan-14, and applies to version <tt>3.7.7</tt>. |
74 | </p> | 74 | </p> |
75 | </font> | 75 | </font> |
76 | </center> | 76 | </center> |
@@ -1010,13 +1010,13 @@ | |||
1010 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1010 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
1011 | h = lanes.linda( [opt_name]) | 1011 | h = lanes.linda( [opt_name]) |
1012 | 1012 | ||
1013 | bool = h:send( [timeout_secs,] key, ... ) | 1013 | bool = h:send( [timeout_secs,] key, ...) |
1014 | 1014 | ||
1015 | [key, val] = h:receive( [timeout_secs,] key [, ...]) | 1015 | [key, val] = h:receive( [timeout_secs,] key [, ...]) |
1016 | 1016 | ||
1017 | [key, val [, ...]] = h:receive( timeout, h.batched, key, n_uint_min[, n_uint_max]) | 1017 | [key, val [, ...]] = h:receive( timeout, h.batched, key, n_uint_min[, n_uint_max]) |
1018 | 1018 | ||
1019 | void = h:limit( key, n_uint) | 1019 | [true] = h:limit( key, n_uint) |
1020 | </pre></td></tr></table> | 1020 | </pre></td></tr></table> |
1021 | 1021 | ||
1022 | <p> | 1022 | <p> |
@@ -1024,7 +1024,11 @@ | |||
1024 | </p> | 1024 | </p> |
1025 | 1025 | ||
1026 | <p> | 1026 | <p> |
1027 | By default, stack sizes are unlimited but limits can be enforced using the <tt>limit</tt> method. This can be useful to balance execution speeds in a producer/consumer scenario. | 1027 | By default, stack sizes are unlimited but limits can be enforced using the <tt>limit</tt> method. This can be useful to balance execution speeds in a producer/consumer scenario. Any negative value removes the limit. |
1028 | <br/> | ||
1029 | A limit of 0 is allowed to block everything. | ||
1030 | <br/> | ||
1031 | (Since version 3.7.7) if the key was full but the limit change added some room, <tt>limit()</tt> returns <tt>true</tt> and the linda is signalled so that <tt>send()</tt>-blocked threads are awakened. | ||
1028 | </p> | 1032 | </p> |
1029 | 1033 | ||
1030 | <p> | 1034 | <p> |
@@ -1036,13 +1040,13 @@ | |||
1036 | </p> | 1040 | </p> |
1037 | 1041 | ||
1038 | <p> | 1042 | <p> |
1039 | <tt>send</tt> returns <tt>true</tt> if the sending succeeded, and <tt>false</tt> if the queue limit was met, and the queue did not empty enough during the given timeout. | 1043 | <tt>send()</tt> returns <tt>true</tt> if the sending succeeded, and <tt>false</tt> if the queue limit was met, and the queue did not empty enough during the given timeout. |
1040 | </p> | 1044 | </p> |
1041 | 1045 | ||
1042 | <p> | 1046 | <p> |
1043 | Equally, <tt>receive</tt> returns a key and the value extracted from it, or nothing for timeout. Note that <tt>nil</tt>s can be sent and received; the <tt>key</tt> value will tell it apart from a timeout. | 1047 | Equally, <tt>receive()</tt> returns a key and the value extracted from it, or nothing for timeout. Note that <tt>nil</tt>s can be sent and received; the <tt>key</tt> value will tell it apart from a timeout. |
1044 | <br> | 1048 | <br> |
1045 | Version 3.4.0 introduces an API change in the returned values: <tt>receive</tt> returns the key followed by the value(s), in that order, and not the other way around. | 1049 | Version 3.4.0 introduces an API change in the returned values: <tt>receive()</tt> returns the key followed by the value(s), in that order, and not the other way around. |
1046 | </p> | 1050 | </p> |
1047 | 1051 | ||
1048 | <p> | 1052 | <p> |
@@ -1055,9 +1059,9 @@ | |||
1055 | </p> | 1059 | </p> |
1056 | 1060 | ||
1057 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1061 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
1058 | linda_h:set( key, [val]) | 1062 | [true] = linda_h:set( key, [val]) |
1059 | 1063 | ||
1060 | [val] = linda_h:get( key ) | 1064 | [val] = linda_h:get( key) |
1061 | </pre></td></tr></table> | 1065 | </pre></td></tr></table> |
1062 | 1066 | ||
1063 | <p> | 1067 | <p> |
@@ -1065,7 +1069,13 @@ | |||
1065 | </p> | 1069 | </p> |
1066 | 1070 | ||
1067 | <p> | 1071 | <p> |
1068 | Writing to a slot overwrites existing value, and clears any possible queued entries. 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. | 1072 | Writing to a slot never blocks because it ignores the limit. It overwrites existing value and clears any possible queued entries. |
1073 | <br/> | ||
1074 | <tt>set()</tt> signals the linda from write if a value is stored. | ||
1075 | <br/> | ||
1076 | (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. | ||
1077 | <br/> | ||
1078 | 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. | ||
1069 | </p> | 1079 | </p> |
1070 | 1080 | ||
1071 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1081 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |