-
Notifications
You must be signed in to change notification settings - Fork 2
/
clorb-io.lisp
762 lines (560 loc) · 23.2 KB
/
clorb-io.lisp
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
;;;; clorb-io.lisp -- a reactive IO layer for CLORB
;; io-init ()
;; io-create-listener (&optional port)
;; io-create-descriptor () => desc
;; io-descriptor-destroy (desc)
;; io-descriptor-connect (desc host port)
;; io-descriptor-working-p (desc) => boolean
;; io-descriptor-set-read (desc buf start end)
;; io-descriptor-set-write (desc buf start end)
;; io-descriptor-status (desc) => status
;; io-descriptor-error (desc) => condition or nil
;; io-descriptor-read-buffer (desc) => buffer
;; io-driver ()
;; io-describe-descriptor (desc)
;; io-get-event () => event, desc
;; io-event-waiting-p () => boolean
;; io-descriptor-shortcut-connect (desc)
;; io-fix-broken ()
;; io-reset (&key listener)
;; io-system-switch (new-class)
(in-package :clorb)
(defparameter *io-background-write-treshold* 200)
(defvar *io-system-default-class* 'io-system-select-blocking-write)
(defvar *io-system* nil)
(defvar *io-listener* nil
"listener socket (or similar). Producer of connections.")
;;;; Event Queue
(defgeneric io-system-queue-event (system event))
(defgeneric io-system-event-waiting-p (system))
(defgeneric io-system-get-event (system &optional non-blocking))
(defun io-queue-event (type desc)
(io-system-queue-event *io-system* (list type desc)))
;;;; IO-DESCRIPTOR
(defstruct io-descriptor
id
(lock (make-lock "desc"))
status
error
connection
;; -- internal --
stream
(read-buffer nil :type (or null octets))
(read-pos 0 :type buffer-index)
(read-limit 0 :type buffer-index)
read-process
(write-buffer nil :type (or null octets))
(write-pos 0 :type buffer-index)
(write-limit 0 :type buffer-index)
write-process
shortcut-p )
;; FIXME: define and document status codes
;; - define what error contain (e.g. a condition)
;; ~ status member nil :connected :broken :destroyed
(defmethod lock ((obj io-descriptor))
(io-descriptor-lock obj))
(defun io-describe-descriptor (desc)
(if (eql (io-descriptor-status desc) :broken)
"BROKEN"
(let ((stream (io-descriptor-stream desc)))
(flet ((describe-peer (stream)
(multiple-value-bind (host port)
(socket-peer stream)
(format nil "~A:~A" host port))))
(typecase stream
(function "loopback")
(stream (if (open-stream-p stream)
(describe-peer stream)
"CLOSED"))
(t (describe-peer stream)))))))
(defmethod print-object ((desc io-descriptor) stream)
(print-unreadable-object (desc stream :type t)
(format stream "~a ~s"
(io-descriptor-id desc)
(io-descriptor-status desc))
(when (io-descriptor-error desc)
(format stream " error: ~s" (io-descriptor-error desc)))
(when (io-descriptor-shortcut-p desc)
(write-string " shortcut" stream))
(format stream " R:~a/~a W:~a/~a"
(io-descriptor-read-pos desc)
(io-descriptor-read-limit desc)
(io-descriptor-write-pos desc)
(io-descriptor-write-limit desc))
(when (and (not (io-descriptor-shortcut-p desc))
(eql (io-descriptor-status desc) :connected))
(format stream " ep=~a" (io-describe-descriptor desc)))))
;;;; Shortcut stream
(defun make-octet-stream (&optional (label (gensym)))
(let ((buffer nil))
(labels
((reader (buf start end)
(let ((len (- end start)))
(when (<= len (length buffer))
(mess 1 "Reading ~A (~D ~D)" label start end)
(replace buf buffer
:start1 start :end1 end
:start2 0 :end2 len)
(setf buffer (subseq buffer len))
len)))
(writer (buf start end)
(mess 1 "Writing ~A (~D ~D)" label start end)
(let ((len (- end start)))
(setf buffer (concatenate 'vector buffer (subseq buf start end)))
len)))
(lambda (op)
(ecase op
((reader) #'reader)
((writer) #'writer)
((buffer) buffer))))))
(defun make-shortcut-stream (input output)
(let ((reader (funcall input 'reader))
(writer (funcall output 'writer)))
(lambda (op buf start end)
(ecase op
((read) (funcall reader buf start end))
((write) (funcall writer buf start end))))))
(defun io-shortcut-write (shortcut-stream seq start end)
(funcall shortcut-stream 'write seq start end))
(defun io-shortcut-read (shortcut-stream seq start end)
(funcall shortcut-stream 'read seq start end))
(defun io-descriptor-shortcut-connect (desc)
(let ((i-stream (make-octet-stream))
(o-stream (make-octet-stream)))
(let ((other (io-create-descriptor
:stream (make-shortcut-stream o-stream i-stream)
:status :connected
:shortcut-p desc)))
(io-queue-event :new other)
(setf (io-descriptor-stream desc) (make-shortcut-stream i-stream o-stream))
(setf (io-descriptor-shortcut-p desc) other))))
;;;; IO-System
(defclass io-system ()
((event-queue
:initform nil
:accessor event-queue)
(io-descriptions
:initform nil
:accessor io-descriptions-of
:documentation "List of all io-descriptors that we will do I/O on.")))
(defmethod io-system-queue-event ((sys io-system) event)
(enqf (event-queue sys) event))
(defmethod io-system-get-event ((system io-system) &optional (non-blocking t))
(when (and (not non-blocking)
(queue-empty-p (event-queue system)))
(io-system-driver system nil ))
(deqf (event-queue system)))
(defmethod io-system-event-waiting-p ((system io-system))
(not (queue-empty-p (event-queue system))))
(defun io-system-switch (new-class)
(io-reset)
(setq *io-system* (make-instance new-class)))
(defgeneric io-ready-for-read (system desc)
(:method ((system io-system) desc)
(declare (ignore desc))))
(defgeneric io-ready-for-write (system desc)
(:documentation
"Do the policy specific thing to initiate writing of the write buffer
stored in descriptor. Should return true if written and no event generated and
return false if event will be generated for completion.")
(:method ((system io-system) desc)
(declare (ignore desc))
nil))
(defgeneric io-system-reset (system)
(:documentation
"IO-System specific reset handling.")
(:method ((system io-system))
(setf (event-queue system) nil)
(flet ((kill (maybe-thread)
(unless (symbolp maybe-thread)
(end-process maybe-thread))))
(dolist (desc (io-descriptions-of system))
(kill (shiftf (io-descriptor-read-process desc) nil))
(kill (shiftf (io-descriptor-write-process desc) nil))
(ignore-errors
(close (io-descriptor-stream desc)))
(setf (io-descriptor-status desc) :broken)))
(setf (io-descriptions-of system) nil)))
(defgeneric io-system-add-descriptor (system desc)
(:documentation
"Add a io-descriptor to the system.")
(:method ((system io-system) desc)
(push desc (io-descriptions-of system))))
(defgeneric io-system-delete-descriptor (system desc)
(:method ((system io-system) desc)
(deletef desc (io-descriptions-of system))))
;;;; Recovery
(defvar *last-io-port* nil)
(defun io-reset (&key (listener nil))
(when (and listener *io-listener*)
(ignore-errors
(listener-close *io-listener*))
(setq *io-listener* (io-create-listener *last-io-port*)))
(io-system-reset *io-system*))
;;;; Creating io-descriptors
(defun io-create-listener (&optional port)
(setq *last-io-port* port)
(setq *io-listener* (open-passive-socket port))
(setq port (or port (passive-socket-port *io-listener*)))
(mess 3 "listener created on ~A" port)
(values port (passive-socket-host *io-listener*)))
(defvar *seq-io-desc* 1)
(defun io-create-descriptor (&key connection status shortcut-p stream)
(let ((desc (make-io-descriptor
:id (incf *seq-io-desc*)
:connection connection
:status status
:shortcut-p shortcut-p
:stream stream
:lock (make-lock "desc"))))
(io-system-add-descriptor *io-system* desc)
desc))
(defun io-descriptor-associate-connection (desc conn)
(setf (io-descriptor-connection desc) conn))
(defun %io-descriptor-close (desc)
(when-let (socket (io-descriptor-stream desc))
(ignore-errors (socket-close socket))
(setf (io-descriptor-stream desc) nil))
(io-system-delete-descriptor *io-system* desc))
(defun io-descriptor-destroy (desc &optional soft)
(with-synchronization desc
(unless (or (eql (io-descriptor-status desc) :destroyed)
(if soft
(io-descriptor-write-process desc)))
(setf (io-descriptor-status desc) :destroyed)
(%io-descriptor-close desc)
(flet ((kill (maybe-thread)
(unless (or (symbolp maybe-thread)
(eql maybe-thread (current-process)))
(end-process maybe-thread))))
(kill (shiftf (io-descriptor-read-process desc) nil))
(kill (shiftf (io-descriptor-write-process desc) nil)))
(setf (io-descriptor-connection desc) nil
(io-descriptor-read-buffer desc) nil
(io-descriptor-write-buffer desc) nil))
nil))
(defun io-descriptor-close (desc)
(with-synchronization desc
(setf (io-descriptor-status desc) :broken)
(%io-descriptor-close desc)))
(defun io-descriptor-shutdown (desc)
"Close the writing end of the socket."
(socket-shutdown (io-descriptor-stream desc)))
(defun io-descriptor-connected-p (desc)
(and (eql (io-descriptor-status desc) :connected)
(io-descriptor-stream desc)))
;;;; Making connections
(defvar *host-translations* '()
"Association list mapping hostnames as found in IORs to some
other hostname or IP-number.")
(defvar *io-loopback-p* nil
"Function called with host and port and answers if connection to this host
port should use loopback." )
(defun io-descriptor-connect (desc host port)
(setq host
(or (cdr (assoc host *host-translations* :test #'string=))
host))
(cond ((and *io-loopback-p*
(funcall *io-loopback-p* host port))
(io-descriptor-shortcut-connect desc)
(mess 3 "made shortcut connection"))
(t
(setf (io-descriptor-stream desc) (open-active-socket host port))
(mess 3 "connect to ~A:~A = ~A" host port (io-descriptor-stream desc))))
(setf (io-descriptor-status desc) :connected))
(defun io-descriptor-working-p (desc)
(and (not (eql (io-descriptor-status desc) :broken))
(not (eql (io-descriptor-status desc) :destroyed))
(or (io-descriptor-shortcut-p desc)
(not (socket-stream-closed-p (io-descriptor-stream desc))))))
;;;; Reading
(defun io-descriptor-read-ready (desc)
(and (io-descriptor-read-buffer desc)
(< (io-descriptor-read-pos desc)
(io-descriptor-read-limit desc))))
(defun io-descriptor-set-read (desc buf start end)
(declare (optimize (speed 2) (safety 3) (debug 1)))
(with-synchronization desc
(setf (io-descriptor-read-buffer desc) buf
(io-descriptor-read-pos desc) start
(io-descriptor-read-limit desc) end))
(when (and buf (> end start))
(io-ready-for-read *io-system* desc))
nil)
;;;; Writing
(defun io-descriptor-write-ready (desc)
(and (io-descriptor-write-buffer desc)
(< (io-descriptor-write-pos desc)
(io-descriptor-write-limit desc))))
(defun io-descriptor-set-write (desc buf start end)
"Initiate writing of buffer.
Only the part between START and END (exlusive) is written. Returns
true if write has been completed and no :write-ready event will be
generated. Otherwise a :write-ready event will signal the completion
of this write."
(with-synchronization desc
(setf (io-descriptor-write-buffer desc) buf
(io-descriptor-write-pos desc) start
(io-descriptor-write-limit desc) end))
(cond ((null buf))
((not (io-descriptor-working-p desc))
(io-queue-event :no-write desc))
(t
(io-ready-for-write *io-system* desc))))
;;;; Listening
(defun io-listen (blocking)
(let ((new (accept-connection-on-socket *io-listener* blocking)))
(when new
(let ((desc (io-create-descriptor)))
(setf (io-descriptor-stream desc) new)
(setf (io-descriptor-status desc) :connected)
(io-queue-event :new desc)))))
(defun io-bg-listen ()
(loop (io-listen t)))
;;;; Shortcut driver
(defun io-poll-shortcut (desc &optional io)
(let ((result nil))
(flet ((out (from)
(when (io-descriptor-write-ready from)
(io-shortcut-write (io-descriptor-stream from)
(io-descriptor-write-buffer from)
(io-descriptor-write-pos from)
(io-descriptor-write-limit from))
(setf (io-descriptor-write-pos from) (io-descriptor-write-limit from))
;;(io-queue-event :write-ready from)
(setq result t)))
(in (to)
(when (and (io-descriptor-read-ready to)
(io-shortcut-read (io-descriptor-stream to)
(io-descriptor-read-buffer to)
(io-descriptor-read-pos to)
(io-descriptor-read-limit to)))
(setf (io-descriptor-read-pos to) (io-descriptor-read-limit to))
(io-queue-event :read-ready to)
(setq result t))))
(case io
(:read (in desc))
(:write (out desc)
(let ((save-result result))
(in (io-descriptor-shortcut-p desc))
(setq result save-result)))
(t (out desc) (in desc)))
result)))
;;;; Blocking Write Mixin
(defclass io-system-blocking-write ()
())
(defun io-broken-descriptor (desc error &optional activity)
(with-synchronization desc
(let ((do-close
(or (not (io-descriptor-connected-p desc))
(not (case activity
((:write) (io-descriptor-read-process desc))
((:read) (io-descriptor-write-process desc)))))))
(setf (io-descriptor-status desc) :broken)
(unless (io-descriptor-error desc)
(setf (io-descriptor-error desc) error))
(case activity
((:write) (setf (io-descriptor-write-process desc) nil))
((:read) (setf (io-descriptor-read-process desc) nil)))
(when do-close
(%io-descriptor-close desc)))))
(defun io-read-broken-descriptor (desc error)
(io-broken-descriptor desc error :read)
(io-queue-event :error desc))
(defun io-write-broken-descriptor (desc error)
(io-broken-descriptor desc error :write)
(io-queue-event :write-ready desc))
(defmethod io-ready-for-write ((system io-system-blocking-write) desc)
"This method does the actual writing."
(cond ((io-descriptor-shortcut-p desc)
(io-poll-shortcut desc :write))
(t
(handler-case
(with-slots (stream write-buffer write-pos write-limit
write-process) desc
(with-synchronization desc
(unless (io-descriptor-connected-p desc)
(return-from io-ready-for-write nil))
(setf write-process (current-process)))
(write-octets write-buffer write-pos write-limit stream)
(setf write-pos write-limit)
(setf write-process nil))
(stream-error (e) (io-broken-descriptor desc e :write)))
t)))
;;;; Select based IO system
(defclass io-system-select (io-system)
())
(defun io-poll-desc (desc status)
(with-slots (stream read-buffer read-limit read-pos
write-buffer write-pos write-limit) desc
(declare (type (or null octets)
read-buffer write-buffer)
(type buffer-index read-limit read-pos
write-limit write-pos))
(let ((writing nil))
(cond ((eq status :error)
(io-read-broken-descriptor desc nil)
(when (io-descriptor-write-ready desc)
(io-queue-event :write-ready desc)))
(status
(handler-case
(progn
(when (and (not (eql status :output))
(io-descriptor-read-ready desc))
(let ((n (read-octets-no-hang read-buffer read-pos
read-limit stream)))
(incf read-pos n)
(if (>= read-pos read-limit)
(io-queue-event :read-ready desc))))
(when (and (member status '(:output :io :append))
(io-descriptor-write-ready desc))
(setq writing t)
(let ((n (write-octets-no-hang write-buffer write-pos
write-limit stream)))
(incf write-pos n)
(if (>= write-pos write-limit)
(io-queue-event :write-ready desc)))))
(stream-error (e)
(if writing
(io-write-broken-descriptor desc e)
(io-read-broken-descriptor desc e)))))))))
(defun io-poll-select (system poll no-write)
(let ((select (make-select)))
(dolist (desc (io-descriptions-of system))
(unless (io-descriptor-shortcut-p desc)
(let ((stream (io-descriptor-stream desc)))
(when stream
(let ((input (io-descriptor-read-ready desc))
(output (if no-write nil
(io-descriptor-write-ready desc))))
(when (or input output)
(select-add-stream select stream input output desc) ))))))
(when *io-listener*
(select-add-listener select *io-listener*))
(setq select (select-wait select poll))
(select-do-result select #'io-poll-desc)
(when *io-listener*
(io-listen (select-listener select *io-listener*)))))
(defmethod io-system-driver ((system io-system-select) poll)
(io-poll-select system poll nil))
(defmethod io-ready-for-write ((system io-system-select) desc)
(if (io-descriptor-shortcut-p desc)
(io-poll-shortcut desc :write)))
(defmethod io-ready-for-read ((system io-system-select) desc)
(if (io-descriptor-shortcut-p desc)
(io-poll-shortcut desc :read)))
;;;; Select with Blocking Writes Driver
(defclass io-system-select-blocking-write (io-system-blocking-write
io-system-select)
())
(defmethod io-system-driver ((system io-system-select-blocking-write) poll)
(io-poll-select system poll t))
;;;; Multi-threaded System Base
(defclass io-system-mt-base (io-system)
((lock :initform (make-lock "system") :reader lock)
(listener-process :initform nil :accessor listener-process)
(event-handler :initarg :event-handler :initform nil :accessor event-handler)))
(defmethod initialize-instance :after ((system io-system-mt-base) &key)
(setf (event-queue system) (make-instance 'shared-queue)))
(defmethod io-start-bg-listen ((system io-system-mt-base))
(unless (listener-process system)
(setf (listener-process system)
(start-process "CORBA listen" #'io-bg-listen))))
(defmethod io-system-queue-event ((system io-system-mt-base) event)
(let ((handler (event-handler system)))
(unless (and handler (funcall handler event))
(enqueue (event-queue system) event))))
(defmethod io-system-get-event ((system io-system-mt-base)
&optional (non-blocking t))
(with-lock (lock system)
(io-start-bg-listen system))
(dequeue (event-queue system) non-blocking))
(defmethod io-system-driver ((system io-system-mt-base) poll)
(declare (ignore poll)))
(defmethod io-system-reset ((system io-system-mt-base))
(with-lock (lock system)
(end-process (shiftf (listener-process system) nil))
(call-next-method)))
(defmethod io-system-add-descriptor ((system io-system-mt-base) desc)
(with-lock (lock system)
(call-next-method)))
(defmethod io-system-delete-descriptor ((system io-system-mt-base) desc)
(with-lock (lock system)
(call-next-method)))
;;;; Multi-threaded system with blocking writes
(defvar *io-mt-read-queue-garb* nil
"Function that cleans idle connections.
Called from read-queue max-handler." )
(defclass io-system-mt-blocking-write (io-system-blocking-write
io-system-mt-base)
((read-queue
:reader read-queue
:initform (make-instance 'execution-queue
:max-idle 4 :max-processes 20
:max-handler *io-mt-read-queue-garb*
:name-template "CLORB Reader"
:executor 'io-mt-read))))
(defun io-mt-read (desc)
(handler-case
(with-slots (stream read-buffer read-pos read-limit read-process) desc
(assert (null read-process))
(loop
(with-synchronization desc
(unless (io-descriptor-connected-p desc)
(return-from io-mt-read nil))
(setf read-process (current-process)))
(assert read-buffer nil
"read-buffer is set")
(read-octets read-buffer read-pos read-limit stream)
(setf read-pos read-limit)
(io-queue-event :read-ready desc)
(with-synchronization desc
(unless (eql read-process :continue)
(setf read-process nil)
(return)))))
(error (e) (io-read-broken-descriptor desc e))))
(defmethod io-ready-for-read ((system io-system-mt-blocking-write) desc)
(if (io-descriptor-shortcut-p desc)
(io-poll-shortcut desc :read)
(with-synchronization desc
(if (io-descriptor-read-process desc)
(setf (io-descriptor-read-process desc) :continue)
(enqueue (read-queue system) desc)))))
;;;; Multi-threaded system with non-blocking writes
(defclass io-system-mt-non-blocking-write (io-system-mt-blocking-write)
((write-queue
:reader write-queue
:initform (make-instance 'execution-queue
:max-idle 4 :max-processes 10
:name-template "CLORB Writer"
:executor 'io-mt-write))))
(defun io-mt-write (desc)
(handler-case
(with-slots (stream write-buffer write-pos write-limit write-process) desc
(assert (null write-process))
(with-synchronization desc
(unless (io-descriptor-connected-p desc)
(return-from io-mt-write nil))
(setf write-process (current-process)))
(write-octets write-buffer write-pos write-limit stream)
(setf write-pos write-limit)
(setf write-process nil))
(error (e) (io-broken-descriptor desc e)))
(io-queue-event :write-ready desc))
(defmethod io-ready-for-write ((system io-system-mt-non-blocking-write) desc)
(if (io-descriptor-shortcut-p desc)
(io-poll-shortcut desc :write)
(progn (enqueue (write-queue system) desc)
nil)))
;;;; Init
(defun io-init ()
(unless *io-system*
(setq *io-system* (make-instance *io-system-default-class*))))
;;;; Driver
(defun io-event-waiting-p ()
(io-system-event-waiting-p *io-system*))
(defun io-get-event (&optional non-blocking)
(io-system-get-event *io-system* non-blocking))
(defun io-driver (poll)
(io-system-driver *io-system* poll))
;;; clorb-io.lisp ends here