255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
+
+
+
+
+
-
+
|
(define (tjq:new #!key (qname (gensym)) (sync-job-cap 100))
(let* ((job-hash (make-hash-table))
(obj-mbox (make-mailbox)))
(letrec
((dispatch-thread
(tjq:dispatcher-thread
job-thread-timeout-seconds: 0.01
timeout-seconds: 0.01
((dispatch-thread (tjq:dispatcher-thread qname job-hash sync-job-cap obj))
qname job-hash sync-job-cap obj))
(obj
(lambda (op . args)
(cond
((eq? op 'event-loop)
(print "got event-loop")
(thread-join! dispatch-thread)
(print "after thread-join dispatch-thread")
|
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
|
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
|
-
+
-
+
|
(iota 6))
;;(thread-sleep! 10)
(q 'drain)
;;(q 'event-loop)
))
(define (test-submit-bunch2)
(let* ((q (tjq:new qname: 'test-q sync-job-cap: 42)))
(let* ((q (tjq:new qname: 'test-q sync-job-cap: 20 )))
(for-each (lambda (x)
;;(let* ((cmd (conc "echo did job "x)))
(let* ((cmd "/bin/true"))
;;(print "submit it--"x)
(q 'submit cmdline: cmd))
)
(iota 600))
(iota 6000))
;;(thread-sleep! 10)
(q 'drain)
;;(q 'event-loop)
))
;(test-tjq-simple)
;;(test-submit)
;;(test-drain-simple)
(print "top")
(test-submit-bunch2)
|