triqs.utility.redirect.T
- class triqs.utility.redirect.T[source]
Bases:
ThreadBackground thread that pumps the C++
stdoutinto Python’s.On
run()the thread creates a pipe, redirects file descriptor1to its write end, and loops on a non-blocking read from the read end, forwarding any bytes tosys.stdout. The previous file descriptor1(captured inoldhandleat construction) is restored whenstop()is invoked and the loop exits.Attributes
go_on
(bool) Loop condition for
run(); set toFalsebystop()to request thread termination.oldhandle
(int) Saved duplicate of the original file descriptor
1, restored viaos.dup2()when the thread stops.Methods
run()Run the pipe-pumping loop until
stop()is called.stop()Request termination; the run loop exits at the next iteration.