pyuv.util — Miscelaneous utilities


Get the high-resolution system time. It’s given in nanoseconds, even if the system doesn’t support nanosecond precision.


Get the system free memory (in bytes).


Get the system total memory (in bytes).


Get the system load average.


Get the current uptime.


Get the current resident memory size.


Get interface addresses information.


Get CPUs information.


Asyncronous equivalent of socket.getaddrinfo. This function returns a GAIRequest object which has a cancel() method that can be called in order to cancel the request.

class pyuv.util.SignalChecker(loop, fd)
  • loop (Loop) – loop object where this handle runs (accessible through SignalChecker.loop).
  • fd (int) – File descriptor to be monitored for readability.

SignalChecker is a handle which can be used to interact with signals set up by the standard signal module.

Here is how it works: the user is required to get a pair of file descriptors and put them in nonblocking mode. These descriptors can be either a os.pipe(), a socket.socketpair() or a manually made pair of connected sockets. One of these descriptors will be used just for writing, and the other end for reading. The user must use signal.set_wakeup_fd and register the write descriptor. The read descriptor must be passed to this handle. When the process receives a signal Python will write on the write end of the socket pair and it will cause the SignalChecker to wakeup the loop and call the Python C API function to process signals: PyErr_CheckSignals.

It’s better to use the Signal handle also provided by this library, because it doesn’t need any work from the user and it works on any thread. This handle merely exists for some cases which you don’t probably care about, or if you want to use the signal module directly.


Start the signal checking handle.


Stop the signal checking handle.

Previous topic

pyuv.thread — Thread synchronization primitives

Next topic

Reference counting scheme

This Page