moonbridge

changeset 148:c51c38d991df

Reverted previous commit (but changes to Makefile)
author jbe
date Thu May 07 22:22:21 2015 +0200 (2015-05-07)
parents 43387f11b096
children c820130f55d7
files moonbridge_io.c
line diff
     1.1 --- a/moonbridge_io.c	Thu May 07 22:16:15 2015 +0200
     1.2 +++ b/moonbridge_io.c	Thu May 07 22:22:21 2015 +0200
     1.3 @@ -73,10 +73,8 @@
     1.4    int nonblocking;
     1.5  } moonbr_io_listener_t;
     1.6  
     1.7 -static int moonbr_io_yield_block(lua_State *L) {
     1.8 -  lua_pushlightuserdata(L, &moonbr_io_block_udata);
     1.9 -  lua_insert(L, 1);
    1.10 -  return lua_yield(L, lua_gettop(L));
    1.11 +static int moonbr_io_yield(lua_State *L) {
    1.12 +  return lua_yield(L, 0);
    1.13  }
    1.14  
    1.15  #if LUA_VERSION_NUM >= 503
    1.16 @@ -93,7 +91,7 @@
    1.17      lua_pushcfunction(L, callfunc); \
    1.18      lua_insert(L, 1); \
    1.19      args = lua_gettop(L); \
    1.20 -    lua_pushcfunction(L, moonbr_io_yield_block); \
    1.21 +    lua_pushcfunction(L, moonbr_io_yield); \
    1.22      lua_insert(L, 3); \
    1.23      lua_callk(L, args, LUA_MULTRET, 0, moonbr_io_cont_returnall); \
    1.24      return lua_gettop(L); \
    1.25 @@ -336,9 +334,10 @@
    1.26        lua_replace(L, 3);
    1.27      }
    1.28      lua_pushvalue(L, 2);
    1.29 +    lua_pushlightuserdata(L, &moonbr_io_block_udata);
    1.30      lua_pushvalue(L, 1);
    1.31      lua_pushliteral(L, "r");
    1.32 -    lua_callk(L, 2, 0, ctx, moonbr_io_read_cont);
    1.33 +    lua_callk(L, 3, 0, ctx, moonbr_io_read_cont);
    1.34    }
    1.35    if (ctx == 1) {
    1.36      lua_pushvalue(L, 5);
    1.37 @@ -400,9 +399,10 @@
    1.38        lua_replace(L, 3);
    1.39      }
    1.40      lua_pushvalue(L, 2);
    1.41 +    lua_pushlightuserdata(L, &moonbr_io_block_udata);
    1.42      lua_pushvalue(L, 1);
    1.43      lua_pushliteral(L, "r");
    1.44 -    lua_callk(L, 2, 0, ctx, moonbr_io_drain_cont);
    1.45 +    lua_callk(L, 3, 0, ctx, moonbr_io_drain_cont);
    1.46    }
    1.47    lua_pushinteger(L, totallen);
    1.48    lua_pushvalue(L, -2);
    1.49 @@ -580,9 +580,10 @@
    1.50      }
    1.51      lua_pop(L, 2);
    1.52      lua_pushvalue(L, 2);
    1.53 +    lua_pushlightuserdata(L, &moonbr_io_block_udata);
    1.54      lua_pushvalue(L, 1);
    1.55      lua_pushliteral(L, "w");
    1.56 -    lua_callk(L, 2, 0, 0, moonbr_io_write_cont);
    1.57 +    lua_callk(L, 3, 0, 0, moonbr_io_write_cont);
    1.58    }
    1.59  }
    1.60  

Impressum / About Us