std atomic wait implementation