Prepared query manager thread and flags