import os import select import threading import time p = select.poll() rfds = [] r, w = os.pipe() for i in range(1000): fd = os.dup(r) rfds.append(fd) p.register(fd, select.POLLIN) def resize_ufds_array(): time.sleep(0.5) # trigger ufds array reallocation for fd in rfds: p.unregister(fd) p.register(w, select.POLLOUT) p.poll() # and make the call to poll() from the main thread return os.write(w, b'hello') t = threading.Thread(target=resize_ufds_array) t.start() p.poll()