Commit 57ad5da
committed
Docs(topics[automation]): Wait on a channel instead of polling
why: The page taught polling with a bound, which costs a tmux round-trip
per read and a sleep paid whether the command finished or not. tmux
offers a rendezvous instead, and it is worth teaching next to the poll
so a reader can see the trade.
what:
- Add "Waiting for a signal instead of polling": a pane signals with
`tmux wait-for -S` and the script waits with `Server.wait_for()`,
bounded so a signal that never arrives is catchable.
- Record two properties of the rendezvous a reader will otherwise meet
the hard way. A wait that times out is abandoned rather than
withdrawn, and tmux only remembers a signal when nothing is waiting,
so the next signal on that channel is spent waking the abandoned wait
-- one signal, after which the channel behaves normally. A fresh
channel name per rendezvous avoids it.
- Note that a returning wait is not proof the work succeeded: tmux
releases every waiter on server shutdown exactly as if the channel had
been signalled, so a pane that died and a command that finished look
the same from the wait alone.1 parent e46466a commit 57ad5da
1 file changed
Lines changed: 59 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
440 | 499 | | |
441 | 500 | | |
442 | 501 | | |
| |||
0 commit comments