Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In fs and stream we need to ensure two pieces of data are not GCd while I/O is happening: any I/O state data (buffers at this point) and the callback that will happen after the I/O is complete. I added a new API and a struct to hold on to this data. rcb is a reference to the callback placed into LUA_REGISTRYINDEX and rdata is a table in LUA_REGISTRYINDEX that any number of state variables can be pushed onto. This is the API: typedef struct { int rcb; /* callback ref */ int rdata; /* string ref */ } luv_cb_state_t; void luv_callback_state_init(luv_cb_state_t *cbs); void luv_callback_state_add(lua_State* L, luv_cb_state_t *cbs, int ndex); void luv_callback_state_callback_add(lua_State* L, luv_cb_state_t *cbs, nt index); void luv_callback_state_callback_rawgeti(lua_State *L, luv_cb_state_t cbs); void luv_callback_state_unref(lua_State* L, luv_cb_state_t *cbs); This first patch introduces the API and converts luv_fs.
- Loading branch information
Brandon Philips
committed
Jun 6, 2012
1 parent
0626990
commit 1807300
Showing
4 changed files
with
73 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters