Locking fix in DynamicTaskQueue

Tasks were not properly locked for notifications whilst scheduling was
in progress. Deadlocks ensued for dynamic scheduling scenarios.