Module: FFI::LastError
- Defined in:
- ext/ffi_c/LastError.c,
ext/ffi_c/LastError.c
Overview
This module defines a couple of method to set and get errno for current thread.
Class Method Summary (collapse)
-
+ (Numeric) error
Get errno value.
-
+ (nil) error(error)
Set errno value.
Instance Method Summary (collapse)
-
- (Numeric) error (private)
private
Get errno value.
-
- (nil) error(error) (private)
private
Set errno value.
Class Method Details
+ (Numeric) error
Get errno value.
115 116 117 118 119 |
# File 'ext/ffi_c/LastError.c', line 115
static VALUE
get_last_error(VALUE self)
{
return INT2NUM(thread_data_get()->td_errno);
}
|
+ (nil) error(error)
Set errno value.
128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'ext/ffi_c/LastError.c', line 128
static VALUE
set_last_error(VALUE self, VALUE error)
{
#ifdef _WIN32
SetLastError(NUM2INT(error));
#else
errno = NUM2INT(error);
#endif
return Qnil;
}
|
Instance Method Details
- (Numeric) error (private)
Get errno value.
115 116 117 118 119 |
# File 'ext/ffi_c/LastError.c', line 115
static VALUE
get_last_error(VALUE self)
{
return INT2NUM(thread_data_get()->td_errno);
}
|
- (nil) error(error) (private)
Set errno value.
128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'ext/ffi_c/LastError.c', line 128
static VALUE
set_last_error(VALUE self, VALUE error)
{
#ifdef _WIN32
SetLastError(NUM2INT(error));
#else
errno = NUM2INT(error);
#endif
return Qnil;
}
|