Sha256: 055056bfd5d4d22748567b9ebf52369877a638138415e471c997c845194cd127

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

#ifndef SLEEPY_PENGUIN_H
#define SLEEPY_PENGUIN_H

#include <ruby.h>
#ifdef HAVE_RUBY_IO_H
#  include <ruby/io.h>
#else
#  include <rubyio.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <assert.h>
#include <unistd.h>

unsigned rb_sp_get_uflags(VALUE klass, VALUE flags);
int rb_sp_get_flags(VALUE klass, VALUE flags);
int rb_sp_io_closed(VALUE io);
int rb_sp_fileno(VALUE io);
void rb_sp_set_nonblock(int fd);

#ifdef HAVE_RB_THREAD_BLOCKING_REGION
static inline VALUE rb_sp_io_region(rb_blocking_function_t *func, void *data)
{
	return rb_thread_blocking_region(func, data, RUBY_UBF_IO, 0);
}
#  define blocking_io_prepare(fd) ((void)(fd))
#else
typedef VALUE rb_blocking_function_t(void *);
VALUE rb_sp_io_region(rb_blocking_function_t *func, void *data);
#  define blocking_io_prepare(fd) rb_sp_set_nonblock((fd))
#endif

#ifdef HAVE_RB_THREAD_IO_BLOCKING_REGION
#  define rb_sp_fd_region(fn,data,fd) \
          rb_thread_io_blocking_region((fn),(data),(fd))
#else
#  define rb_sp_fd_region(fn,data,fd) rb_sp_io_region(fn,data)
#endif

#define NODOC_CONST(klass,name,value) \
  rb_define_const((klass),(name),(value))
#endif /* SLEEPY_PENGUIN_H */

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sleepy_penguin-3.0.1 ext/sleepy_penguin/sleepy_penguin.h
sleepy_penguin-3.0.0 ext/sleepy_penguin/sleepy_penguin.h