Method: ConcurrentSHM::Region.unmap

Defined in:
ext/concurrent-shm/posix.c

.unmap(region) ⇒ Object

Unmaps a memory-mapped region.

Parameters:

  • region (Region)

    the region to unmap



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'ext/concurrent-shm/posix.c', line 344

static VALUE region_unmap(VALUE self, VALUE region)
{
    UNUSED(self);

    region_t * r = value_as_region(region);
    if (!r->mapped) {
        rb_raise(rb_eArgError, "Not a memory mapped region");
    }

    if (!r->data) {
        return Qnil;
    }

    chk_errno(munmap, (r->data, r->len), "");

    r->data = NULL;
    r->len = 0;
    return Qnil;
}