my class Semaphore is repr('Semaphore') {
    method new(int $permits) {
        nqp::box_i($permits, Semaphore);
    }
    method acquire() {
        nqp::semacquire(self);
    }
    method try_acquire(--> Bool:D) {
        nqp::semtryacquire(self) ?? True !! False;
    }
    method release() {
        nqp::semrelease(self);
    }
}

# vim: ft=perl6 expandtab sw=4

my class Semaphore is repr('Semaphore') {
    method new(int $permits) {
        nqp::box_i($permits, Semaphore);
    }
    method acquire() {
        nqp::semacquire(self);
    }
    method try_acquire(--> Bool:D) {
        nqp::p6bool(nqp::semtryacquire(self))
    }
    method release() {
        nqp::semrelease(self);
    }
}

# vim: ft=perl6 expandtab sw=4

Use nqp::p6bool in lieu of ?? !!
Use nqp::p6bool in lieu of ?? !!

Since we optimized this case recently, this is faster.
