Hi,

KGI used to set a task to sleep when it was mapped away from a display.
This didn't work always, and with some help from #kernelnewbies, I came to
the conclusion that it isn't even what you want.

A task doesn't need to sleep, it only has to stop drawing. I came to a
very simple, but (imho) ingenious solution: Send the task a signal. When
reading the docs, I noticed that POSIX even defines a signal specially
made for this, SIGTTOU. This signal is sent to a background process that
tries to write to its controlling tty. (*)

The default behaviour of a process is that it is stopped. This looks a
little ugly on its controlling text console (You see the same as when
pressing ^Z), and with a "fg" the task starts writing again (without
setting the mode back), but it is a start.

LibGGI can catch this signal, and behave like it. It can block all drawing
(maybe if a program requested a directbuffer, sleeping really is the only
solution). When LibGGI catches this signal, the "fg" issue is over
immediately.

I'd like to know whether you like this idea, or I have to find another
solution.

Jos

(*) SIGTTOU confirmed available on Linux, (Free,Open,Net)BSD, Solaris,
MacOSX, other platforms untested.

Reply via email to