Sha256: 605374c5b6095be6173785e432abb97127fe97f8ca2022eeb2b7ce6f6952df75

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

/*
 * Copyright (c) 2011 Tony Arcieri. Distributed under the MIT License. See
 * LICENSE.txt for further details.
 */

#ifndef NIO4R_H
#define NIO4R_H

#include "ruby.h"
#include "ruby/io.h"
#include "libev.h"

struct NIO_Selector
{
    ev_loop *ev_loop;
    struct ev_timer timer; /* for timeouts */
    struct ev_io wakeup;

    int ready_count;
    int closed, selecting;
    int wakeup_reader, wakeup_writer;
    volatile int wakeup_fired;

    VALUE ready_array;
};

struct NIO_callback_data
{
    VALUE *monitor;
    struct NIO_Selector *selector;
};

struct NIO_Monitor
{
    VALUE self;
    int interests, revents;
    struct ev_io ev_io;
    struct NIO_Selector *selector;
};

struct NIO_ByteBuffer
{
    char *buffer;
    int position, limit, capacity, mark;
};


#ifdef GetReadFile
# define FPTR_TO_FD(fptr) (fileno(GetReadFile(fptr)))
#else
# define FPTR_TO_FD(fptr) fptr->fd
#endif /* GetReadFile */

/* Thunk between libev callbacks in NIO::Monitors and NIO::Selectors */
void NIO_Selector_monitor_callback(struct ev_loop *ev_loop, struct ev_io *io, int revents);

#endif /* NIO4R_H */

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nio4r-2.3.1-java ext/nio4r/nio4r.h
nio4r-2.3.1 ext/nio4r/nio4r.h
nio4r-2.3.0-java ext/nio4r/nio4r.h
nio4r-2.3.0 ext/nio4r/nio4r.h
nio4r-2.2.0-java ext/nio4r/nio4r.h
nio4r-2.2.0 ext/nio4r/nio4r.h
nio4r-2.1.0-java ext/nio4r/nio4r.h
nio4r-2.1.0 ext/nio4r/nio4r.h