TLS not being async signal safe is explicitly called out on the article as the reason the token is sent in clear text.
> Handle it as a synchronous event in a main loop
Of course of you rearchitect the client there are better solutions. But again, the article mentions that's not planned for now.
By comparison, delegating cancellation to a background background thread can be done non-intrusively. In principe no code outside the cancel path need changing.
Edit: the article mentions that there is a refactor in the works to implement cancel over tls [1]. Turns out that they decided to use a thread (with a pipe for signaling).
[1] https://www.postgresql.org/message-id/flat/DEY0N7FS8NCU.1F7Q...