Fix compat10 semaphore interface race
PR: 265997
(cherry picked from commit 768f6373eb3d60e346d3bfa495e04315aeed8ff9)