I want to get a custom list for a user-command whose information comes from a job. When I query the job the response is captured by the out_cb callback.
In my mind I should implement a semaphore to have a sound solution:
GetInfoForCompletionList() -> QueryJob() (turn semaphore on) -> wait for out on out_cb -> message received (turn semaphore off) -> GetInfoForCompletionList() is now unlocked and can display the result.
but I am not even sure if it works because Vim does not support multi-threading.
Any workaround to cope with this problem?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Assuming I understand your scenario correctly.
Since Vim only ever uses a single thread you should be able to use
a simple flag.
GetInfoForCompletionList() can loop until the flag is set. Perhaps
something like:
let g:reply = []
let g:flag = 0
call QueryJob()
while g:flag == 0
:sleep 1ms
endwhile
" Now g:replay has data read by the `out_cb`.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()