Skip to content

Comment on In the C++ bag of tricks: scoped locks

Comments

Exception issues aside, an odd definition of "scoped". A very non-C++ solution. Use RAII and lock_guard (if possible) as vinkelhake demonstrates. Consider,

    LOCKED(lk_var) {
        return 42; // whoops
    }
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.