diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2013-05-20 11:13:05 +0200 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2013-05-20 11:13:05 +0200 |
commit | 894803c8982d7d08fad487fd55c7f18d03a20fd2 (patch) | |
tree | 799c209f4da1249379b7f9d42a060ab4b75717e9 /docs | |
parent | d88be799239f1895f08b6faa9c9154a98ad3c40b (diff) | |
download | lanes-894803c8982d7d08fad487fd55c7f18d03a20fd2.tar.gz lanes-894803c8982d7d08fad487fd55c7f18d03a20fd2.tar.bz2 lanes-894803c8982d7d08fad487fd55c7f18d03a20fd2.zip |
Added a sample snippet for set_finalizer()
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.html | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/index.html b/docs/index.html index 3bf000a..ede2d21 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -880,6 +880,23 @@ | |||
880 | An error in a finalizer itself overrides the state of the regular chunk (in practise, it would be highly preferable <i>not</i> to have errors in finalizers). If one finalizer errors, the others may not get called. | 880 | An error in a finalizer itself overrides the state of the regular chunk (in practise, it would be highly preferable <i>not</i> to have errors in finalizers). If one finalizer errors, the others may not get called. |
881 | </p> | 881 | </p> |
882 | 882 | ||
883 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> | ||
884 | local lane_body = function() | ||
885 | set_finalizer( function( err, stk) | ||
886 | if err and type( err) ~= "userdata" then | ||
887 | -- no special error: true error | ||
888 | print( " error: "..tostring(err)) | ||
889 | elseif type( err) == "userdata" then | ||
890 | -- lane cancellation is performed by throwing a special userdata as error | ||
891 | print( "after cancel") | ||
892 | else | ||
893 | -- no error: we just got finalized | ||
894 | print( "finalized") | ||
895 | end | ||
896 | end) | ||
897 | end | ||
898 | </pre></td></tr></table> | ||
899 | |||
883 | 900 | ||
884 | <!-- lindas +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 901 | <!-- lindas +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
885 | <hr/> | 902 | <hr/> |