[minor] add locking to scheduler
Merge pull request #321 from pdvyas/scheduler-lock

[minor] add locking to scheduler