tty_yield(0)?

May 20, 2008
12,171
133
Syracuse, NY, USA
I have often used tty_yield(0) in a loop while waiting for something to happen, and wanting thread messages to be processed (e.g., if I have SetWinEventHook() and I'm waiting for the hook process to SetEvent()).

For that purpose, I find that (simply)

Code:
PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)

works as well. I'm curious ... what else does tty_yield(0) do?
 

rconn

Administrator
Staff member
May 14, 2008
12,557
167
I have often used tty_yield(0) in a loop while waiting for something to happen, and wanting thread messages to be processed (e.g., if I have SetWinEventHook() and I'm waiting for the hook process to SetEvent()).

For that purpose, I find that (simply)

Code:
PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)

works as well. I'm curious ... what else does tty_yield(0) do?

Nothing, if you pass 0. If you pass 1, it's a whole different ballgame. (But that's not anything you should be doing anyway!)