Notification for I/O events (reads and writes on file descriptors) is
done by the the gobject-based event loop. File descriptors are registered
with gobject with the appropriate flags for read/write/disconnect
notification.

Time-based events, the results of callLater and
callFromThread, are handled differently. Rather than
registering each event with gobject, a single gobject timeout is registered
for the earliest scheduled event, the output of
reactor.timeout(). For example, if there are timeouts in 1, 2
and 3.4 seconds, a single timeout is registered for 1 second in the future.
When this timeout is hit, _simulate is called, which calls the
appropriate Twisted-level handlers, and a new timeout is added to gobject
by the _reschedule method.

To handle callFromThread events, we use a custom waker that
calls _simulate whenever it wakes up.

A flag which indicates whether any signal handlers will be installed during
startup. This includes handlers for SIGCHLD to monitor child processes,
and SIGINT, SIGTERM, and SIGBREAK to stop the reactor. (type: bool)

A flag which is true between the time reactor.stop is called
and the time the shutdown system event is fired. This is used to determine
whether that event should be fired after each iteration through the
mainloop. This should be replaced with an explicit state machine. (type: bool)

A flag which is true from the time reactor.run is called until
the time reactor.run returns. This is used to prevent calls
to reactor.run on a running reactor. This should be replaced
with an explicit state machine. (type: bool)

Add the given FileDescriptor
for monitoring either for reading or writing. If the file is already
monitored for the other operation, we delete the previous registration and
re-register it for both reading and writing.