mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
add comment
This commit is contained in:
@@ -82,6 +82,15 @@ lnewbuffer(lua_State *L) {
|
||||
int size
|
||||
|
||||
return size
|
||||
|
||||
Comment: The table pool record all the buffers chunk,
|
||||
and the first index [1] is a lightuserdata : free_node. We can always use this pointer for struct buffer_node .
|
||||
The following ([2] ...) userdatas in table pool is the buffer chunk (for struct buffer_node),
|
||||
we never free them until the VM closed. The size of first chunk ([2]) is 8 struct buffer_node,
|
||||
and the second size is 16 ... The largest size of chunk is LARGE_PAGE_NODE (4096)
|
||||
|
||||
lpushbbuffer will get a free struct buffer_node from table pool, and then put the msg/size in it.
|
||||
lpopbuffer return the struct buffer_node back to table pool (By calling return_free_node).
|
||||
*/
|
||||
static int
|
||||
lpushbuffer(lua_State *L) {
|
||||
|
||||
Reference in New Issue
Block a user