4 ms·
higher order function, function taking an other function (/ block). E.g. in Ruby you can lock/unlock a mutex, but the normal way to do it would be to pass a bl
by masklinn 1y ago
higher order function, function taking an other function (/ block).
E.g. in Ruby you can lock/unlock a mutex, but the normal way to do it would be to pass a block to `Mutex#synchronize` which is essentially just
def synchronize
lock
begin
yield
ensure
unlock
end
end
and called as:
lock.synchronize {
# protected code here
}
- deleted 1y ago[deleted]