Implementation of getwork long-polling