Here it is an example: If we oversimplify json parsing consist of 2 parts.
1. JSON parsing to Jansson data structures
2. Converting Jasson data structures to lisp data structures.
If we assume that 1 is taking most of the time then we could write the following code:
start(string, callback) -> convert string to char* -> post it to worker thread -> worker thread does the parsing
-> worker thread post to main loop -> main loop converts Jansson ds to lisp ds -> main loop
calls the callback passed on start
The same strategy probably could be applied to Font locking with TreeSitter.
Thanks,
Ivan