Added interruption flag checking for the worker threads and the manager
thread.