uringmachine 0.5 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/um/um_class.c CHANGED
@@ -14,7 +14,6 @@ static void UM_mark(void *ptr) {
14
14
  static void UM_compact(void *ptr) {
15
15
  struct um *machine = ptr;
16
16
  machine->self = rb_gc_location(machine->self);
17
- machine->poll_fiber = rb_gc_location(machine->poll_fiber);
18
17
 
19
18
  um_op_list_compact(machine, machine->transient_head);
20
19
  um_op_list_compact(machine, machine->runqueue_head);
@@ -41,7 +40,7 @@ static VALUE UM_allocate(VALUE klass) {
41
40
  return TypedData_Wrap_Struct(klass, &UM_type, machine);
42
41
  }
43
42
 
44
- inline struct um *get_machine(VALUE self) {
43
+ inline struct um *um_get_machine(VALUE self) {
45
44
  struct um *machine = RTYPEDDATA_DATA(self);
46
45
  if (!machine->ring_initialized)
47
46
  rb_raise(rb_eRuntimeError, "Machine not initialized");
@@ -55,45 +54,45 @@ VALUE UM_initialize(VALUE self) {
55
54
  }
56
55
 
57
56
  VALUE UM_setup_buffer_ring(VALUE self, VALUE size, VALUE count) {
58
- struct um *machine = get_machine(self);
57
+ struct um *machine = um_get_machine(self);
59
58
  int bgid = um_setup_buffer_ring(machine, NUM2UINT(size), NUM2UINT(count));
60
59
  return INT2NUM(bgid);
61
60
  }
62
61
 
63
62
  VALUE UM_pending_count(VALUE self) {
64
- struct um *machine = get_machine(self);
63
+ struct um *machine = um_get_machine(self);
65
64
  return INT2NUM(machine->pending_count);
66
65
  }
67
66
 
68
67
  VALUE UM_snooze(VALUE self) {
69
- struct um *machine = get_machine(self);
68
+ struct um *machine = um_get_machine(self);
70
69
  um_schedule(machine, rb_fiber_current(), Qnil);
71
70
  return um_await(machine);
72
71
  }
73
72
 
74
73
  VALUE UM_yield(VALUE self) {
75
- struct um *machine = get_machine(self);
74
+ struct um *machine = um_get_machine(self);
76
75
  return um_await(machine);
77
76
  }
78
77
 
79
78
  VALUE UM_schedule(VALUE self, VALUE fiber, VALUE value) {
80
- struct um *machine = get_machine(self);
79
+ struct um *machine = um_get_machine(self);
81
80
  um_schedule(machine, fiber, value);
82
81
  return self;
83
82
  }
84
83
 
85
84
  VALUE UM_timeout(VALUE self, VALUE interval, VALUE class) {
86
- struct um *machine = get_machine(self);
85
+ struct um *machine = um_get_machine(self);
87
86
  return um_timeout(machine, interval, class);
88
87
  }
89
88
 
90
89
  VALUE UM_sleep(VALUE self, VALUE duration) {
91
- struct um *machine = get_machine(self);
90
+ struct um *machine = um_get_machine(self);
92
91
  return um_sleep(machine, NUM2DBL(duration));
93
92
  }
94
93
 
95
94
  VALUE UM_read(int argc, VALUE *argv, VALUE self) {
96
- struct um *machine = get_machine(self);
95
+ struct um *machine = um_get_machine(self);
97
96
  VALUE fd;
98
97
  VALUE buffer;
99
98
  VALUE maxlen;
@@ -108,7 +107,7 @@ VALUE UM_read(int argc, VALUE *argv, VALUE self) {
108
107
 
109
108
  VALUE UM_read_each(VALUE self, VALUE fd, VALUE bgid) {
110
109
  #ifdef HAVE_IO_URING_PREP_READ_MULTISHOT
111
- struct um *machine = get_machine(self);
110
+ struct um *machine = um_get_machine(self);
112
111
  return um_read_each(machine, NUM2INT(fd), NUM2INT(bgid));
113
112
  #else
114
113
  rb_raise(rb_eRuntimeError, "Not supported by kernel");
@@ -116,7 +115,7 @@ VALUE UM_read_each(VALUE self, VALUE fd, VALUE bgid) {
116
115
  }
117
116
 
118
117
  VALUE UM_write(int argc, VALUE *argv, VALUE self) {
119
- struct um *machine = get_machine(self);
118
+ struct um *machine = um_get_machine(self);
120
119
  VALUE fd;
121
120
  VALUE buffer;
122
121
  VALUE len;
@@ -127,27 +126,27 @@ VALUE UM_write(int argc, VALUE *argv, VALUE self) {
127
126
  }
128
127
 
129
128
  VALUE UM_close(VALUE self, VALUE fd) {
130
- struct um *machine = get_machine(self);
129
+ struct um *machine = um_get_machine(self);
131
130
  return um_close(machine, NUM2INT(fd));
132
131
  }
133
132
 
134
133
  VALUE UM_accept(VALUE self, VALUE fd) {
135
- struct um *machine = get_machine(self);
134
+ struct um *machine = um_get_machine(self);
136
135
  return um_accept(machine, NUM2INT(fd));
137
136
  }
138
137
 
139
138
  VALUE UM_accept_each(VALUE self, VALUE fd) {
140
- struct um *machine = get_machine(self);
139
+ struct um *machine = um_get_machine(self);
141
140
  return um_accept_each(machine, NUM2INT(fd));
142
141
  }
143
142
 
144
143
  VALUE UM_socket(VALUE self, VALUE domain, VALUE type, VALUE protocol, VALUE flags) {
145
- struct um *machine = get_machine(self);
144
+ struct um *machine = um_get_machine(self);
146
145
  return um_socket(machine, NUM2INT(domain), NUM2INT(type), NUM2INT(protocol), NUM2UINT(flags));
147
146
  }
148
147
 
149
148
  VALUE UM_connect(VALUE self, VALUE fd, VALUE host, VALUE port) {
150
- struct um *machine = get_machine(self);
149
+ struct um *machine = um_get_machine(self);
151
150
 
152
151
  struct sockaddr_in addr;
153
152
  memset(&addr, 0, sizeof(addr));
@@ -159,17 +158,17 @@ VALUE UM_connect(VALUE self, VALUE fd, VALUE host, VALUE port) {
159
158
  }
160
159
 
161
160
  VALUE UM_send(VALUE self, VALUE fd, VALUE buffer, VALUE len, VALUE flags) {
162
- struct um *machine = get_machine(self);
161
+ struct um *machine = um_get_machine(self);
163
162
  return um_send(machine, NUM2INT(fd), buffer, NUM2INT(len), NUM2INT(flags));
164
163
  }
165
164
 
166
165
  VALUE UM_recv(VALUE self, VALUE fd, VALUE buffer, VALUE maxlen, VALUE flags) {
167
- struct um *machine = get_machine(self);
166
+ struct um *machine = um_get_machine(self);
168
167
  return um_recv(machine, NUM2INT(fd), buffer, NUM2INT(maxlen), NUM2INT(flags));
169
168
  }
170
169
 
171
170
  VALUE UM_recv_each(VALUE self, VALUE fd, VALUE bgid, VALUE flags) {
172
- struct um *machine = get_machine(self);
171
+ struct um *machine = um_get_machine(self);
173
172
  return um_recv_each(machine, NUM2INT(fd), NUM2INT(bgid), NUM2INT(flags));
174
173
  }
175
174
 
@@ -181,7 +180,7 @@ VALUE UM_bind(VALUE self, VALUE fd, VALUE host, VALUE port) {
181
180
  addr.sin_port = htons(NUM2INT(port));
182
181
 
183
182
  #ifdef HAVE_IO_URING_PREP_BIND
184
- struct um *machine = get_machine(self);
183
+ struct um *machine = um_get_machine(self);
185
184
  return um_bind(machine, NUM2INT(fd), (struct sockaddr *)&addr, sizeof(addr));
186
185
  #else
187
186
  int res = bind(NUM2INT(fd), (struct sockaddr *)&addr, sizeof(addr));
@@ -193,7 +192,7 @@ VALUE UM_bind(VALUE self, VALUE fd, VALUE host, VALUE port) {
193
192
 
194
193
  VALUE UM_listen(VALUE self, VALUE fd, VALUE backlog) {
195
194
  #ifdef HAVE_IO_URING_PREP_LISTEN
196
- struct um *machine = get_machine(self);
195
+ struct um *machine = um_get_machine(self);
197
196
  return um_listen(machine, NUM2INT(fd), NUM2INT(backlog));
198
197
  #else
199
198
  int res = listen(NUM2INT(fd), NUM2INT(backlog));
@@ -215,43 +214,43 @@ static inline int numeric_value(VALUE value) {
215
214
  }
216
215
 
217
216
  VALUE UM_getsockopt(VALUE self, VALUE fd, VALUE level, VALUE opt) {
218
- struct um *machine = get_machine(self);
217
+ struct um *machine = um_get_machine(self);
219
218
  return um_getsockopt(machine, NUM2INT(fd), NUM2INT(level), NUM2INT(opt));
220
219
  }
221
220
 
222
221
  VALUE UM_setsockopt(VALUE self, VALUE fd, VALUE level, VALUE opt, VALUE value) {
223
- struct um *machine = get_machine(self);
222
+ struct um *machine = um_get_machine(self);
224
223
  return um_setsockopt(machine, NUM2INT(fd), NUM2INT(level), NUM2INT(opt), numeric_value(value));
225
224
  }
226
225
 
227
226
  #ifdef HAVE_IO_URING_PREP_FUTEX
228
227
 
229
228
  VALUE UM_mutex_synchronize(VALUE self, VALUE mutex) {
230
- struct um *machine = get_machine(self);
229
+ struct um *machine = um_get_machine(self);
231
230
  struct um_mutex *mutex_data = Mutex_data(mutex);
232
231
  return um_mutex_synchronize(machine, &mutex_data->state);
233
232
  }
234
233
 
235
234
  VALUE UM_queue_push(VALUE self, VALUE queue, VALUE value) {
236
- struct um *machine = get_machine(self);
235
+ struct um *machine = um_get_machine(self);
237
236
  struct um_queue *que = Queue_data(queue);
238
237
  return um_queue_push(machine, que, value);
239
238
  }
240
239
 
241
240
  VALUE UM_queue_pop(VALUE self, VALUE queue) {
242
- struct um *machine = get_machine(self);
241
+ struct um *machine = um_get_machine(self);
243
242
  struct um_queue *que = Queue_data(queue);
244
243
  return um_queue_pop(machine, que);
245
244
  }
246
245
 
247
246
  VALUE UM_queue_unshift(VALUE self, VALUE queue, VALUE value) {
248
- struct um *machine = get_machine(self);
247
+ struct um *machine = um_get_machine(self);
249
248
  struct um_queue *que = Queue_data(queue);
250
249
  return um_queue_unshift(machine, que, value);
251
250
  }
252
251
 
253
252
  VALUE UM_queue_shift(VALUE self, VALUE queue) {
254
- struct um *machine = get_machine(self);
253
+ struct um *machine = um_get_machine(self);
255
254
  struct um_queue *que = Queue_data(queue);
256
255
  return um_queue_shift(machine, que);
257
256
  }
@@ -270,7 +269,7 @@ VALUE UM_open_ensure(VALUE arg) {
270
269
  }
271
270
 
272
271
  VALUE UM_open(VALUE self, VALUE pathname, VALUE flags) {
273
- struct um *machine = get_machine(self);
272
+ struct um *machine = um_get_machine(self);
274
273
  // TODO: take optional perm (mode) arg
275
274
  VALUE fd = um_open(machine, pathname, NUM2INT(flags), 0666);
276
275
  if (rb_block_given_p()) {
@@ -282,10 +281,15 @@ VALUE UM_open(VALUE self, VALUE pathname, VALUE flags) {
282
281
  }
283
282
 
284
283
  VALUE UM_waitpid(VALUE self, VALUE pid, VALUE options) {
285
- struct um *machine = get_machine(self);
284
+ struct um *machine = um_get_machine(self);
286
285
  return um_waitpid(machine, NUM2INT(pid), NUM2INT(options));
287
286
  }
288
287
 
288
+ VALUE UM_prep_timeout(VALUE self, VALUE interval) {
289
+ struct um *machine = um_get_machine(self);
290
+ return um_prep_timeout(machine, NUM2DBL(interval));
291
+ }
292
+
289
293
  VALUE UM_pipe(VALUE self) {
290
294
  int fds[2];
291
295
  int ret = pipe(fds);
@@ -341,6 +345,8 @@ void Init_UM(void) {
341
345
  rb_define_method(cUM, "setsockopt", UM_setsockopt, 4);
342
346
  rb_define_method(cUM, "socket", UM_socket, 4);
343
347
 
348
+ rb_define_method(cUM, "prep_timeout", UM_prep_timeout, 1);
349
+
344
350
  #ifdef HAVE_IO_URING_PREP_FUTEX
345
351
  rb_define_method(cUM, "pop", UM_queue_pop, 1);
346
352
  rb_define_method(cUM, "push", UM_queue_push, 2);
@@ -349,5 +355,7 @@ void Init_UM(void) {
349
355
  rb_define_method(cUM, "unshift", UM_queue_unshift, 2);
350
356
  #endif
351
357
 
358
+ // Init_micro_ssl(cUM);
359
+
352
360
  um_define_net_constants(cUM);
353
361
  }
data/ext/um/um_const.c CHANGED
@@ -16,6 +16,19 @@
16
16
  #define DEF_CONST_INT(mod, v) rb_define_const(mod, #v, INT2NUM(v))
17
17
 
18
18
  void um_define_net_constants(VALUE mod) {
19
+ DEF_CONST_INT(mod, MSG_CONFIRM);
20
+ DEF_CONST_INT(mod, MSG_DONTROUTE);
21
+ DEF_CONST_INT(mod, MSG_DONTWAIT);
22
+ DEF_CONST_INT(mod, MSG_EOR);
23
+ DEF_CONST_INT(mod, MSG_ERRQUEUE);
24
+ DEF_CONST_INT(mod, MSG_FASTOPEN);
25
+ DEF_CONST_INT(mod, MSG_MORE);
26
+ DEF_CONST_INT(mod, MSG_NOSIGNAL);
27
+ DEF_CONST_INT(mod, MSG_OOB);
28
+ DEF_CONST_INT(mod, MSG_PEEK);
29
+ DEF_CONST_INT(mod, MSG_TRUNC);
30
+ DEF_CONST_INT(mod, MSG_WAITALL);
31
+
19
32
  DEF_CONST_INT(mod, O_APPEND);
20
33
  DEF_CONST_INT(mod, O_CLOEXEC);
21
34
  DEF_CONST_INT(mod, O_CREAT);
@@ -38,7 +51,6 @@ void um_define_net_constants(VALUE mod) {
38
51
  DEF_CONST_INT(mod, WCONTINUED);
39
52
  DEF_CONST_INT(mod, WEXITED);
40
53
  DEF_CONST_INT(mod, WSTOPPED);
41
- DEF_CONST_INT(mod, WCONTINUED);
42
54
  DEF_CONST_INT(mod, WNOWAIT);
43
55
 
44
56
  DEF_CONST_INT(mod, SOCK_STREAM);
@@ -64,13 +76,6 @@ void um_define_net_constants(VALUE mod) {
64
76
  DEF_CONST_INT(mod, AF_MAX);
65
77
  DEF_CONST_INT(mod, PF_MAX);
66
78
 
67
- DEF_CONST_INT(mod, MSG_OOB);
68
- DEF_CONST_INT(mod, MSG_PEEK);
69
- DEF_CONST_INT(mod, MSG_DONTROUTE);
70
- DEF_CONST_INT(mod, MSG_WAITALL);
71
- DEF_CONST_INT(mod, MSG_DONTWAIT);
72
- DEF_CONST_INT(mod, MSG_MORE);
73
-
74
79
  DEF_CONST_INT(mod, SOL_SOCKET);
75
80
  DEF_CONST_INT(mod, SOL_IP);
76
81
 
@@ -146,7 +151,7 @@ void um_define_net_constants(VALUE mod) {
146
151
  DEF_CONST_INT(mod, TCP_WINDOW_CLAMP);
147
152
  DEF_CONST_INT(mod, TCP_FASTOPEN);
148
153
  DEF_CONST_INT(mod, TCP_CONGESTION);
149
- DEF_CONST_INT(mod, TCP_COOKIE_TRANSACTIONS);
154
+ // DEF_CONST_INT(mod, TCP_COOKIE_TRANSACTIONS);
150
155
  DEF_CONST_INT(mod, TCP_QUEUE_SEQ);
151
156
  DEF_CONST_INT(mod, TCP_REPAIR);
152
157
  DEF_CONST_INT(mod, TCP_REPAIR_OPTIONS);
@@ -210,4 +215,135 @@ void um_define_net_constants(VALUE mod) {
210
215
  DEF_CONST_INT(mod, IF_NAMESIZE);
211
216
 
212
217
  DEF_CONST_INT(mod, SOMAXCONN);
218
+
219
+ DEF_CONST_INT(mod, EPERM);
220
+ DEF_CONST_INT(mod, ENOENT);
221
+ DEF_CONST_INT(mod, ESRCH);
222
+ DEF_CONST_INT(mod, EINTR);
223
+ DEF_CONST_INT(mod, EIO);
224
+ DEF_CONST_INT(mod, ENXIO);
225
+ DEF_CONST_INT(mod, E2BIG);
226
+ DEF_CONST_INT(mod, ENOEXEC);
227
+ DEF_CONST_INT(mod, EBADF);
228
+ DEF_CONST_INT(mod, ECHILD);
229
+ DEF_CONST_INT(mod, EAGAIN);
230
+ DEF_CONST_INT(mod, ENOMEM);
231
+ DEF_CONST_INT(mod, EACCES);
232
+ DEF_CONST_INT(mod, EFAULT);
233
+ DEF_CONST_INT(mod, ENOTBLK);
234
+ DEF_CONST_INT(mod, EBUSY);
235
+ DEF_CONST_INT(mod, EEXIST);
236
+ DEF_CONST_INT(mod, EXDEV);
237
+ DEF_CONST_INT(mod, ENODEV);
238
+ DEF_CONST_INT(mod, ENOTDIR);
239
+ DEF_CONST_INT(mod, EISDIR);
240
+ DEF_CONST_INT(mod, EINVAL);
241
+ DEF_CONST_INT(mod, ENFILE);
242
+ DEF_CONST_INT(mod, EMFILE);
243
+ DEF_CONST_INT(mod, ENOTTY);
244
+ DEF_CONST_INT(mod, ETXTBSY);
245
+ DEF_CONST_INT(mod, EFBIG);
246
+ DEF_CONST_INT(mod, ENOSPC);
247
+ DEF_CONST_INT(mod, ESPIPE);
248
+ DEF_CONST_INT(mod, EROFS);
249
+ DEF_CONST_INT(mod, EMLINK);
250
+ DEF_CONST_INT(mod, EPIPE);
251
+ DEF_CONST_INT(mod, EDOM);
252
+ DEF_CONST_INT(mod, ERANGE);
253
+ DEF_CONST_INT(mod, EDEADLK);
254
+ DEF_CONST_INT(mod, ENAMETOOLONG);
255
+ DEF_CONST_INT(mod, ENOLCK);
256
+ DEF_CONST_INT(mod, ENOSYS);
257
+ DEF_CONST_INT(mod, ENOTEMPTY);
258
+ DEF_CONST_INT(mod, ELOOP);
259
+ DEF_CONST_INT(mod, ENOMSG);
260
+ DEF_CONST_INT(mod, EIDRM);
261
+ DEF_CONST_INT(mod, ECHRNG);
262
+ DEF_CONST_INT(mod, EL2NSYNC);
263
+ DEF_CONST_INT(mod, EL3HLT);
264
+ DEF_CONST_INT(mod, EL3RST);
265
+ DEF_CONST_INT(mod, ELNRNG);
266
+ DEF_CONST_INT(mod, EUNATCH);
267
+ DEF_CONST_INT(mod, ENOCSI);
268
+ DEF_CONST_INT(mod, EL2HLT);
269
+ DEF_CONST_INT(mod, EBADE);
270
+ DEF_CONST_INT(mod, EBADR);
271
+ DEF_CONST_INT(mod, EXFULL);
272
+ DEF_CONST_INT(mod, ENOANO);
273
+ DEF_CONST_INT(mod, EBADRQC);
274
+ DEF_CONST_INT(mod, EBADSLT);
275
+ DEF_CONST_INT(mod, EBFONT);
276
+ DEF_CONST_INT(mod, ENOSTR);
277
+ DEF_CONST_INT(mod, ENODATA);
278
+ DEF_CONST_INT(mod, ETIME);
279
+ DEF_CONST_INT(mod, ENOSR);
280
+ DEF_CONST_INT(mod, ENONET);
281
+ DEF_CONST_INT(mod, ENOPKG);
282
+ DEF_CONST_INT(mod, EREMOTE);
283
+ DEF_CONST_INT(mod, ENOLINK);
284
+ DEF_CONST_INT(mod, EADV);
285
+ DEF_CONST_INT(mod, ESRMNT);
286
+ DEF_CONST_INT(mod, ECOMM);
287
+ DEF_CONST_INT(mod, EPROTO);
288
+ DEF_CONST_INT(mod, EMULTIHOP);
289
+ DEF_CONST_INT(mod, EDOTDOT);
290
+ DEF_CONST_INT(mod, EBADMSG);
291
+ DEF_CONST_INT(mod, EOVERFLOW);
292
+ DEF_CONST_INT(mod, ENOTUNIQ);
293
+ DEF_CONST_INT(mod, EBADFD);
294
+ DEF_CONST_INT(mod, EREMCHG);
295
+ DEF_CONST_INT(mod, ELIBACC);
296
+ DEF_CONST_INT(mod, ELIBBAD);
297
+ DEF_CONST_INT(mod, ELIBSCN);
298
+ DEF_CONST_INT(mod, ELIBMAX);
299
+ DEF_CONST_INT(mod, ELIBEXEC);
300
+ DEF_CONST_INT(mod, EILSEQ);
301
+ DEF_CONST_INT(mod, ERESTART);
302
+ DEF_CONST_INT(mod, ESTRPIPE);
303
+ DEF_CONST_INT(mod, EUSERS);
304
+ DEF_CONST_INT(mod, ENOTSOCK);
305
+ DEF_CONST_INT(mod, EDESTADDRREQ);
306
+ DEF_CONST_INT(mod, EMSGSIZE);
307
+ DEF_CONST_INT(mod, EPROTOTYPE);
308
+ DEF_CONST_INT(mod, ENOPROTOOPT);
309
+ DEF_CONST_INT(mod, EPROTONOSUPPORT);
310
+ DEF_CONST_INT(mod, ESOCKTNOSUPPORT);
311
+ DEF_CONST_INT(mod, EOPNOTSUPP);
312
+ DEF_CONST_INT(mod, EPFNOSUPPORT);
313
+ DEF_CONST_INT(mod, EAFNOSUPPORT);
314
+ DEF_CONST_INT(mod, EADDRINUSE);
315
+ DEF_CONST_INT(mod, EADDRNOTAVAIL);
316
+ DEF_CONST_INT(mod, ENETDOWN);
317
+ DEF_CONST_INT(mod, ENETUNREACH);
318
+ DEF_CONST_INT(mod, ENETRESET);
319
+ DEF_CONST_INT(mod, ECONNABORTED);
320
+ DEF_CONST_INT(mod, ECONNRESET);
321
+ DEF_CONST_INT(mod, ENOBUFS);
322
+ DEF_CONST_INT(mod, EISCONN);
323
+ DEF_CONST_INT(mod, ENOTCONN);
324
+ DEF_CONST_INT(mod, ESHUTDOWN);
325
+ DEF_CONST_INT(mod, ETOOMANYREFS);
326
+ DEF_CONST_INT(mod, ETIMEDOUT);
327
+ DEF_CONST_INT(mod, ECONNREFUSED);
328
+ DEF_CONST_INT(mod, EHOSTDOWN);
329
+ DEF_CONST_INT(mod, EHOSTUNREACH);
330
+ DEF_CONST_INT(mod, EALREADY);
331
+ DEF_CONST_INT(mod, EINPROGRESS);
332
+ DEF_CONST_INT(mod, ESTALE);
333
+ DEF_CONST_INT(mod, EUCLEAN);
334
+ DEF_CONST_INT(mod, ENOTNAM);
335
+ DEF_CONST_INT(mod, ENAVAIL);
336
+ DEF_CONST_INT(mod, EISNAM);
337
+ DEF_CONST_INT(mod, EREMOTEIO);
338
+ DEF_CONST_INT(mod, EDQUOT);
339
+ DEF_CONST_INT(mod, ENOMEDIUM);
340
+ DEF_CONST_INT(mod, EMEDIUMTYPE);
341
+ DEF_CONST_INT(mod, ECANCELED);
342
+ DEF_CONST_INT(mod, ENOKEY);
343
+ DEF_CONST_INT(mod, EKEYEXPIRED);
344
+ DEF_CONST_INT(mod, EKEYREVOKED);
345
+ DEF_CONST_INT(mod, EKEYREJECTED);
346
+ DEF_CONST_INT(mod, EOWNERDEAD);
347
+ DEF_CONST_INT(mod, ENOTRECOVERABLE);
348
+
213
349
  }
data/ext/um/um_ext.c CHANGED
@@ -1,9 +1,13 @@
1
1
  void Init_UM();
2
2
  void Init_Mutex();
3
3
  void Init_Queue();
4
+ void Init_AsyncOp();
5
+ void Init_SSL();
4
6
 
5
7
  void Init_um_ext(void) {
6
8
  Init_UM();
7
9
  Init_Mutex();
8
10
  Init_Queue();
11
+ Init_AsyncOp();
12
+ // Init_SSL();
9
13
  }
data/ext/um/um_op.c CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  inline void um_op_clear(struct um *machine, struct um_op *op) {
4
4
  memset(op, 0, sizeof(struct um_op));
5
- RB_OBJ_WRITE(machine->self, &op->fiber, Qnil);
6
- RB_OBJ_WRITE(machine->self, &op->value, Qnil);
5
+ op->fiber = Qnil;
6
+ op->value = Qnil;
7
+ op->async_op = Qnil;
7
8
  }
8
9
 
9
10
  inline void um_op_transient_add(struct um *machine, struct um_op *op) {
@@ -50,6 +51,7 @@ inline void um_op_list_mark(struct um *machine, struct um_op *head) {
50
51
  struct um_op *next = head->next;
51
52
  rb_gc_mark_movable(head->fiber);
52
53
  rb_gc_mark_movable(head->value);
54
+ rb_gc_mark_movable(head->async_op);
53
55
  head = next;
54
56
  }
55
57
  }
@@ -59,6 +61,7 @@ inline void um_op_list_compact(struct um *machine, struct um_op *head) {
59
61
  struct um_op *next = head->next;
60
62
  head->fiber = rb_gc_location(head->fiber);
61
63
  head->value = rb_gc_location(head->value);
64
+ head->async_op = rb_gc_location(head->async_op);
62
65
  head = next;
63
66
  }
64
67
  }