diff options
author | Mike Pall <mike> | 2012-11-07 23:20:50 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2012-11-07 23:20:50 +0100 |
commit | 74feb2534c20482ba3e69b4796b49481c3658de0 (patch) | |
tree | 372a2cba9ba5d98c135c0c6b6f2bd231a7a175a9 /doc | |
parent | 2156925b9b7dc9758d3d490f107025615a24b85f (diff) | |
download | luajit-74feb2534c20482ba3e69b4796b49481c3658de0.tar.gz luajit-74feb2534c20482ba3e69b4796b49481c3658de0.tar.bz2 luajit-74feb2534c20482ba3e69b4796b49481c3658de0.zip |
FFI: Clarify callback docs.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ext_ffi_semantics.html | 13 |
1 files changed, 7 insertions, 6 deletions
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. | |||
943 | <p> | 943 | <p> |
944 | However, this heuristic may fail under specific circumstances: e.g. a | 944 | However, this heuristic may fail under specific circumstances: e.g. a |
945 | message polling function might not run Lua callbacks right away and the call | 945 | message polling function might not run Lua callbacks right away and the call |
946 | gets JIT-compiled. If it later happens to call back into Lua, you'll get a | 946 | gets JIT-compiled. If it later happens to call back into Lua (e.g. a rarely |
947 | VM PANIC with the message <tt>"bad callback"</tt>. Then you'll need to | 947 | invoked error callback), you'll get a VM PANIC with the message |
948 | manually turn off JIT-compilation with | 948 | <tt>"bad callback"</tt>. Then you'll need to manually turn off |
949 | JIT-compilation with | ||
949 | <a href="ext_jit.html#jit_onoff_func"><tt>jit.off()</tt></a> for the | 950 | <a href="ext_jit.html#jit_onoff_func"><tt>jit.off()</tt></a> for the |
950 | surrounding Lua function that invokes such a message polling function (or | 951 | surrounding Lua function that invokes such a message polling function (or |
951 | similar). | 952 | similar). |
@@ -1038,9 +1039,9 @@ of existing C APIs. E.g. callback performance is irrelevant for a | |||
1038 | GUI application, which waits for user input most of the time, anyway. | 1039 | GUI application, which waits for user input most of the time, anyway. |
1039 | </p> | 1040 | </p> |
1040 | <p> | 1041 | <p> |
1041 | For new designs <b>avoid push-style APIs</b> (C function repeatedly | 1042 | For new designs <b>avoid push-style APIs</b>: a C function repeatedly |
1042 | calling a callback for each result). Instead <b>use pull-style APIs</b> | 1043 | calling a callback for each result. Instead <b>use pull-style APIs</b>: |
1043 | (call a C function repeatedly to get a new result). Calls from Lua | 1044 | call a C function repeatedly to get a new result. Calls from Lua |
1044 | to C via the FFI are much faster than the other way round. Most well-designed | 1045 | to C via the FFI are much faster than the other way round. Most well-designed |
1045 | libraries already use pull-style APIs (read/write, get/put). | 1046 | libraries already use pull-style APIs (read/write, get/put). |
1046 | </p> | 1047 | </p> |