module FFI::LastError

This module defines a couple of method to set and get errno for current thread.

Public Class Methods

error click to toggle source
@return [Numeric]
Get +errno+ value.
static VALUE
get_last_error(VALUE self)
{
    return INT2NUM(thread_data_get()->td_errno);
}
error(error) click to toggle source
@param [Numeric] error
@return [nil]
Set +errno+ value.
static VALUE
set_last_error(VALUE self, VALUE error)
{

#ifdef _WIN32
    SetLastError(NUM2INT(error));
#else
    errno = NUM2INT(error);
#endif

    return Qnil;
}