Ruby
1.9.3p484(2013-11-22revision43786)
Main Page
Modules
Data Structures
Files
File List
Globals
ext
-test-
wait_for_single_fd
wait_for_single_fd.c
Go to the documentation of this file.
1
#include "
ruby/ruby.h
"
2
#include "
ruby/io.h
"
3
4
static
VALUE
5
wait_for_single_fd
(
VALUE
ign,
VALUE
fd,
VALUE
events,
VALUE
timeout)
6
{
7
struct
timeval
tv;
8
struct
timeval
*tvp =
NULL
;
9
int
rc;
10
11
if
(!
NIL_P
(timeout)) {
12
tv =
rb_time_timeval
(timeout);
13
tvp = &tv;
14
}
15
16
rc =
rb_wait_for_single_fd
(
NUM2INT
(fd),
NUM2INT
(events), tvp);
17
if
(rc == -1)
18
rb_sys_fail
(
"rb_wait_for_single_fd"
);
19
return
INT2NUM
(rc);
20
}
21
22
void
23
Init_wait_for_single_fd
(
void
)
24
{
25
rb_define_const
(
rb_cObject
,
"RB_WAITFD_IN"
,
INT2NUM
(
RB_WAITFD_IN
));
26
rb_define_const
(
rb_cObject
,
"RB_WAITFD_OUT"
,
INT2NUM
(
RB_WAITFD_OUT
));
27
rb_define_const
(
rb_cObject
,
"RB_WAITFD_PRI"
,
INT2NUM
(
RB_WAITFD_PRI
));
28
rb_define_singleton_method
(
rb_cIO
,
"wait_for_single_fd"
,
29
wait_for_single_fd
, 3);
30
}
31
Generated on Fri Nov 22 2013 07:03:57 for Ruby by
1.8.3