I was wondering where to trigger SafeState.  I first thought it would be
sufficient to do this higher up, where we are going to wait for the user
to type a character and nothing is pending.  Then it's safe to deal with
any callbacks.

However, think of this scenario:
        1. In a safe state, SafeState is triggered.
        2. Waiting for a character, receive a message.
        3. Invoke callback for the message, it uses ch_evalexpr().
        4. While in ch_evalexpr() another message arrives.  Since it's
           not safe now, work is postponed.
        5. ch_evalexpr() finishes
        6. go back to waiting for a character

Now, so long as the user doesn't type anything, the work won't be
executed.  That may take long time.  Or the user is actually waiting for
the work to be done, which is a kind of deadlock.

Thus it seems that we need to trigger SafeState also before 6.  Under
the condition we started waiting for a character in a safe state.
And it was not safe at some moment (to avoid it being triggered too
often).

It does mean that the display won't be updated, thus we would need to do
that, like when a timer callback was invoked.

Does this sound OK?

-- 
This sentence is not sure that it exists, but if it does, it will
certainly consider the possibility that other sentences exist.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201909152019.x8FKJ6NF002969%40masaka.moolenaar.net.

Reply via email to