Skip to content

Commit 74feb25

Browse files
author
Mike Pall
committed
FFI: Clarify callback docs.
1 parent 2156925 commit 74feb25

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

doc/ext_ffi_semantics.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -943,9 +943,10 @@ <h2 id="callback">Callbacks</h2>
943943
<p>
944944
However, this heuristic may fail under specific circumstances: e.g. a
945945
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
947-
VM PANIC with the message <tt>"bad callback"</tt>. Then you'll need to
948-
manually turn off JIT-compilation with
946+
gets JIT-compiled. If it later happens to call back into Lua (e.g. a rarely
947+
invoked error callback), you'll get a VM PANIC with the message
948+
<tt>"bad callback"</tt>. Then you'll need to manually turn off
949+
JIT-compilation with
949950
<a href="ext_jit.html#jit_onoff_func"><tt>jit.off()</tt></a> for the
950951
surrounding Lua function that invokes such a message polling function (or
951952
similar).
@@ -1038,9 +1039,9 @@ <h3 id="callback_performance">Callback performance</h3>
10381039
GUI application, which waits for user input most of the time, anyway.
10391040
</p>
10401041
<p>
1041-
For new designs <b>avoid push-style APIs</b> (C&nbsp;function repeatedly
1042-
calling a callback for each result). Instead <b>use pull-style APIs</b>
1043-
(call a C&nbsp;function repeatedly to get a new result). Calls from Lua
1042+
For new designs <b>avoid push-style APIs</b>: a C&nbsp;function repeatedly
1043+
calling a callback for each result. Instead <b>use pull-style APIs</b>:
1044+
call a C&nbsp;function repeatedly to get a new result. Calls from Lua
10441045
to C via the FFI are much faster than the other way round. Most well-designed
10451046
libraries already use pull-style APIs (read/write, get/put).
10461047
</p>

0 commit comments

Comments
 (0)