From e97adefde985e30fe31ffa036c74ffb0ce10ca26 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Tue, 1 Mar 2011 21:12:56 +0100 Subject: * fixed potential crash at application shutdown when calling lua_close() on a killed thread's VM. * exposed cancel_test() in the lanes to enable manual testing for cancellation requests. * removed kludgy {globals={threadName}} support, replaced with a new function set_debug_threadname(). --- docs/index.html | 72 +++++++++++++++++++++++++-------------------------------- 1 file changed, 32 insertions(+), 40 deletions(-) (limited to 'docs') diff --git a/docs/index.html b/docs/index.html index 3d2ecf2..ba25515 100644 --- a/docs/index.html +++ b/docs/index.html @@ -56,7 +56,7 @@


Copyright © 2007-11 Asko Kauppi. All rights reserved.
Lua Lanes is published under the same MIT license as Lua 5.1. -

This document was revised on 21-Feb-11, and applies to version 2.1.0. +

This document was revised on 1-Mar-11, and applies to version 2.1.0.

@@ -243,6 +243,7 @@ also in the new lanes. :receive() or :send() call. With this option, one can set cancellation check to occur every N Lua statements. The value true uses a default value (100). + It is also possible to manually test for cancel requests with cancel_test(). @@ -250,20 +251,21 @@ also in the new lanes. Sets the globals table for the launched threads. This can be used for giving them constants. -

+
The global values of different lanes are in no manner connected; - modifying one will only affect the particular lane. Settings the variable 'threadName' in this table makes VS display the sent name instead of the normal thread name while debugging. + modifying one will only affect the particular lane. .priority
-2..+2 The priority of lanes generated. -2 is lowest, +2 is highest. -

+
Implementation and dependability of priorities varies by platform. Especially Linux kernel 2.6 is not supporting priorities in user mode. - +

Each lane also gets a function set_debug_threadname() that it can use anytime to do as the name says. +Supported debuggers are Microsoft Visual Studio (for the C side) and Decoda (for the Lua side).

Free running lanes

@@ -374,10 +376,15 @@ that id over a Linda once that thread is done (as the last thing you do).

Cancelling

- bool= lane_h:cancel( [timeout_secs=0.0,] [force_kill_bool=false] ) + bool= lane_h:cancel( [timeout_secs=0.0,] [force_kill_bool=false] ) +
+
+ + bool= cancel_test() +
-

Sends a cancellation request to the lane. If timeout_secs is non-zero, waits +

cancel()sends a cancellation request to the lane. If timeout_secs is non-zero, waits for the request to be processed, or a timeout to occur. Returns true if the lane was already done (in "done", "error" or "cancelled" status) or if the cancellation was fruitful within timeout period. @@ -387,8 +394,9 @@ OS thread running the lane is forcefully killed. This means no GC, and should generally be the last resort.

Cancellation is tested before going to sleep in receive() or send() calls -and after executing cancelstep Lua statements. A currently pending receive -or send call is currently not awakened, and may be a reason for a non-detected cancel. +and after executing cancelstep Lua statements. A currently pending receive() +or send() call is currently not awakened, and may be a reason for a non-detected cancel. +It is also possible to manually test for cancel requests with cancel_test().

@@ -799,7 +807,7 @@ can be used for custom userdata as well. Here's what to do.

  1. Provide an identity function for your userdata, in C. This function is - used for creation and deletion of your deep userdata (the shared resource), +used for creation and deletion of your deep userdata (the shared resource), and for making metatables for the state-specific proxies for accessing it. The prototype is @@ -817,12 +825,12 @@ can be used for custom userdata as well. Here's what to do. "delete": receives this same pointer on the stack, and should cleanup the object.
  2. "metatable": should build a metatable for the object. Don't cache the metatable - yourself, Lanes takes care of it ("metatable" should only be invoked once).
  3. +yourself, Lanes takes care of it ("metatable" should only be invoked once).
  4. "module": is the name of the module that exports the idfunc, - to be pushed on the stack as a string. It is necessary so that Lanes can require it in - any Lane and keeper state that receives a userdata. This is to prevent crashes in situations - where the module could be unloaded while the idfunc pointer is still held.
  5. +to be pushed on the stack as a string. It is necessary so that Lanes can require it in +any Lane and keeper state that receives a userdata. This is to prevent crashes in situations +where the module could be unloaded while the idfunc pointer is still held. Take a look at linda_id in lanes.c. @@ -917,10 +925,10 @@ Here are some things one should consider, if best performance is vital: merged into one main timer state (see timer.lua); no OS side timers are utilized. -
  6. Lindas are hashed to a number of "keeper states", which are a locking entity. - If you are using a lot of Linda objects, it may be useful to try having more of - these keeper states. By default, only one is used but this is an implementation detail. - It is possible to require( "lanes", N) to use more keeper states. +
  7. Lindas are hashed to a fixed number of "keeper states", which are a locking entity. + If you are using a lot of Linda objects, + it may be useful to try having more of these keeper states. By default, + only one is used (see KEEPER_STATES_N), but this is an implementation detail.
  8. @@ -952,31 +960,15 @@ its actual value.

    Change log

    -Feb-2011 (2.1.0) + +Mar-2011 (2.1.0)

      -
    • Added an auto-require mechanism to ensure any deep userdata transiting in a lane causes its parent module to be required in that lane -
        -
      • Changed idfunc signature and contract to clarify the fact it is not lua-callable and to be able to require the module it was exported from in the target lanes
      • -
      • When a deep userdata idfunc requests a module to be required, manually check that it is not loaded before requiring it instead of relying on the require function's loop detection feature
      • -
      • When a module must be required, raise an error if the 'require' function is not found in the target state
      • -
      • We know Lanes is loaded in the master state, so we don't force it to be required in every lane too when a linda deep userdata is copied
      • -
      -
    • -
    • Fixed application hang-up because keeper state was not released in case of errors thrown by inter-state data copy for unsupported types
    • -
    • Refactor lane proxy implementation: it is now a full userdata instead of a table, and its methods are implemented in C instead of Lua -
        -
      • its metatable is no longer accessible
      • -
      • writing to the proxy raises an error
      • -
      • it is no longer possible to overwrite its join() and cancel() methods
      • -
      -
    • -
    • Moved keeper-related code in a separate source file
    • -
    • keeper.lua is now embedded in text form instead of bytecode to improve LuaJIT2-compatibility
    • -
    • Make the number of internal keeper states selctable by an optional parameter passed to require.
    • +
    • fixed potential crash at application shutdown when calling lua_close() on a killed thread's VM.
    • +
    • exposed cancel_test() in the lanes to enable manual testing for cancellation requests.
    • +
    • removed kludgy {globals={threadName}} support, replaced with a new function set_debug_threadname().
    - Feb-2011 (2.0.11): -
      +
      • Fixed bug where reference to Linda object was dropped for a short time (crashing if GC was run during that time).
      • Changed the atexit code to trip the timer thread's write signal.
      • Changed lanes.c to export functions as a module rather than writing them directly to the globals table.
      • -- cgit v1.2.3-55-g6feb