put pause lock in scope for RAII and notify task empty at right time