use ascii ENQ (0x05) for watchdog pings

pull/445/head
romkatv 5 years ago
parent 45d14cbcf5
commit 148ecf7fc3

@ -86,10 +86,8 @@ typeset -g _p9k__worker_file_prefix
typeset -gA _p9k__worker_request_map typeset -gA _p9k__worker_request_map
typeset -ga _p9k__worker_request_queue typeset -ga _p9k__worker_request_queue
# invoked in master: _p9k_worker_send_params [param]... # todo: remove these
function _p9k_worker_send_params() { } function _p9k_worker_send_params() { }
# invoked in master: _p9k_worker_send_functions [function-name]...
function _p9k_worker_send_functions() { } function _p9k_worker_send_functions() { }
# invoked in master: _p9k_worker_invoke <request-id> <cond> <async> <sync> # invoked in master: _p9k_worker_invoke <request-id> <cond> <async> <sync>
@ -155,10 +153,9 @@ function _p9k_worker_receive() {
sysread -i $_p9k__worker_resp_fd 'buf[$#buf+1]' || return sysread -i $_p9k__worker_resp_fd 'buf[$#buf+1]' || return
done done
for resp in ${(ps:\x1e:)buf}; do for resp in ${(ps:\x1e:)${buf//$'\x05'}}; do
local arg=$resp[2,-1] local arg=$resp[2,-1]
case $resp[1] in case $resp[1] in
p) ;;
d) d)
local req=$_p9k__worker_request_map[$arg] local req=$_p9k__worker_request_map[$arg]
if [[ -n $req ]]; then if [[ -n $req ]]; then
@ -229,7 +226,7 @@ function _p9k_worker_start() {
_p9k_worker_main $pgid & _p9k_worker_main $pgid &
{ {
trap '' PIPE trap '' PIPE
while syswrite p$'\x1e'; do zselect -t 1000; done while syswrite $'\x05'; do zselect -t 1000; done
kill -- -$pgid kill -- -$pgid
} & } &
exec =true) || return exec =true) || return

@ -10,8 +10,6 @@
disabling implicit reset on every eval in _p9k_worker_receive. disabling implicit reset on every eval in _p9k_worker_receive.
- implement fake gitstatus api on top of vcs_info (or plain git?) + worker and use it if there is no - implement fake gitstatus api on top of vcs_info (or plain git?) + worker and use it if there is no
gitstatus. gitstatus.
- when worker_main kills itself, the gpid is wrong.
- spawn watchdog from within <(...) right after worker_main. it should sleep on zselect (zselect should be loaded in <(...)) and try to write zero bytes to stdout. on failure, kill the group.
_p9k_worker_async cb1 cb2 _p9k_worker_async cb1 cb2

Loading…
Cancel
Save