Xlib, the original C binding to the protocol is not great in that situation, because it makes many asynchronous requests look synchronous. Most toolkits are pretty terrible in that situation. libxcb instead of Xlib can be a great improvement as it exposes what can be asynchronous (though it often isn't used well).