Sha256: fee76f762ec44cc837ab898f91884a0fa077154ef66feea25a049a841e27b18e

Contents?: true

Size: 438 Bytes

Versions: 6

Compression:

Stored size: 438 Bytes

Contents

#ifndef SLEEPY_PENGUIN_NONBLOCK_H
#define SLEEPY_PENGUIN_NONBLOCK_H
#include <unistd.h>
#include <fcntl.h>
#include <ruby.h>
static void set_nonblock(int fd)
{
	int flags = fcntl(fd, F_GETFL);

	if (flags == -1)
		rb_sys_fail("fcntl(F_GETFL)");
	if ((flags & O_NONBLOCK) == O_NONBLOCK)
		return;
	flags = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
	if (flags == -1)
		rb_sys_fail("fcntl(F_SETFL)");
}

#endif /* SLEEPY_PENGUIN_NONBLOCK_H */

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sleepy_penguin-1.4.0 ext/sleepy_penguin/nonblock.h
sleepy_penguin-1.3.1 ext/sleepy_penguin/nonblock.h
sleepy_penguin-1.3.0 ext/sleepy_penguin/nonblock.h
sleepy_penguin-1.2.0 ext/sleepy_penguin/nonblock.h
sleepy_penguin-1.1.1 ext/sleepy_penguin/nonblock.h
sleepy_penguin-1.0.0 ext/sleepy_penguin/nonblock.h