From 74feb2534c20482ba3e69b4796b49481c3658de0 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Wed, 7 Nov 2012 23:20:50 +0100 Subject: FFI: Clarify callback docs. --- doc/ext_ffi_semantics.html | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html index c2107663..bf9f9bee 100644 --- a/doc/ext_ffi_semantics.html +++ b/doc/ext_ffi_semantics.html @@ -943,9 +943,10 @@ C function is blacklisted for compilation.

However, this heuristic may fail under specific circumstances: e.g. a message polling function might not run Lua callbacks right away and the call -gets JIT-compiled. If it later happens to call back into Lua, you'll get a -VM PANIC with the message "bad callback". Then you'll need to -manually turn off JIT-compilation with +gets JIT-compiled. If it later happens to call back into Lua (e.g. a rarely +invoked error callback), you'll get a VM PANIC with the message +"bad callback". Then you'll need to manually turn off +JIT-compilation with jit.off() for the surrounding Lua function that invokes such a message polling function (or similar). @@ -1038,9 +1039,9 @@ of existing C APIs. E.g. callback performance is irrelevant for a GUI application, which waits for user input most of the time, anyway.

-For new designs avoid push-style APIs (C function repeatedly -calling a callback for each result). Instead use pull-style APIs -(call a C function repeatedly to get a new result). Calls from Lua +For new designs avoid push-style APIs: a C function repeatedly +calling a callback for each result. Instead use pull-style APIs: +call a C function repeatedly to get a new result. Calls from Lua to C via the FFI are much faster than the other way round. Most well-designed libraries already use pull-style APIs (read/write, get/put).

-- cgit v1.2.3-55-g6feb