clogger RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
15634b896e510ad72730686a458a09b1f7234762 blob 1702 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && defined(HAVE_RUBY_THREAD_H)
/* Ruby 2.0+ */
#  include <ruby/thread.h>
#  define WITHOUT_GVL(fn,a,ubf,b) \
        rb_thread_call_without_gvl((fn),(a),(ubf),(b))
#elif defined(HAVE_RB_THREAD_BLOCKING_REGION)
typedef VALUE (*my_blocking_fn_t)(void*);
#  define WITHOUT_GVL(fn,a,ubf,b) \
	rb_thread_blocking_region((my_blocking_fn_t)(fn),(a),(ubf),(b))
#endif

#ifdef WITHOUT_GVL
struct stat_args { int err; const char *path; struct stat *buf; };
static void * ng_stat(void *ptr)
{
	struct stat_args *a = ptr;
	a->err = stat(a->path, a->buf);
	return NULL;
}

static int my_stat(const char *path, struct stat *buf)
{
	struct stat_args a;

	a.path = path;
	a.buf = buf;
	WITHOUT_GVL(ng_stat, &a, RUBY_UBF_IO, 0);
	return a.err;
}

#ifndef HAVE_RB_THREAD_IO_BLOCKING_REGION
#  define rb_thread_io_blocking_region(fn,data,fd) \
           WITHOUT_GVL((fn),(data), RUBY_UBF_IO, 0)
#else
  VALUE rb_thread_io_blocking_region(VALUE(*)(void *), void *, int);
#endif

struct write_args { int fd; const void *buf; size_t count; };
static VALUE ng_write(void *ptr)
{
	struct write_args *a = ptr;

	return (VALUE)write(a->fd, a->buf, a->count);
}
static ssize_t my_write(int fd, const void *buf, size_t count)
{
	struct write_args a;
	ssize_t r;

	a.fd = fd;
	a.buf = buf;
	a.count = count;
	r = (ssize_t)rb_thread_io_blocking_region(ng_write, &a, fd);

	return r;
}
#  define nogvl_stat(path,buf) my_stat((path),(buf))
#  define nogvl_write(fd,buf,count) my_write((fd),(buf),(count))
#else /* !WITHOUT_GVL, for Ruby 1.8 users: */
#  define nogvl_stat(path,buf) stat((path),(buf))
#  define nogvl_write(fd,buf,buf) write((fd),(buf),(count))
#endif /* !WITHOUT_GVL */
debug log:

solving 15634b8 ...
found 15634b8 in https://bogomips.org/clogger.git

clogger RubyGem user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://bogomips.org/clogger-public
	git clone --mirror http://ou63pmih66umazou.onion/clogger-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.clogger
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.clogger

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox