Added wait option to consumeDirtyData