Locking fix in DynamicTaskQueue

Tasks were not properly locked for notifications whilst scheduling was
in progress. Deadlocks ensued for dynamic scheduling scenarios.
Avoid double unlockForNotifications
Merge pull request #330 from kaihowl/pullrequest/fix-dynamic

Locking fix in DynamicTaskQueue