Changeset 39717 in project for release/5/mailbox/trunk/mailbox.scm


Ignore:
Timestamp:
03/15/21 07:29:12 (5 months ago)
Author:
Kon Lovett
Message:

queue depth limit by type (wip)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/mailbox/trunk/mailbox.scm

    r39716 r39717  
    3737  mailbox-timeout-condition?
    3838  ;Mailbox API
     39  make-limited-mailbox
    3940  make-mailbox
    40   make-limited-mailbox
    4141  mailbox?
    4242  mailbox-name
     
    7272  (only (srfi 1) append! delete! list-copy last-pair)
    7373  (only (srfi 18)
    74     time?
    75     current-thread
    76     thread-signal! thread-sleep!
    77     thread-suspend! thread-resume!))
     74    time? current-thread thread-signal! thread-sleep! thread-suspend! thread-resume!))
    7875
    7976;;; Typoes
    8077
    8178(define-type srfi-18-time   (struct time))
    82 (define-type mailbox        (struct mailbox))
    83 (define-type mailbox-cursor (struct mailbox-cursor))
    8479(define-type time-number    (or fixnum float))
    8580(define-type timeout        (or time-number srfi-18-time))
    8681(define-type unique-object  (vector-of symbol))
     82(define-type buffering      (or boolean fixnum))
     83(define-type mailbox        (struct mailbox))
     84(define-type mailbox-cursor (struct mailbox-cursor))
    8785
    8886(: mailbox-timeout-condition?         (* -> boolean : condition))
    89 (: make-mailbox                       (#!optional * -> mailbox))
    90 (: make-limited-mailbox               (#!optional (or boolean fixnum) * -> mailbox))
     87(: make-limited-mailbox               (#!optional buffering * -> mailbox))
     88(: make-mailbox                       (#!optional * buffering -> mailbox))
    9189(: mailbox?                           (* -> boolean : mailbox))
    9290(: mailbox-name                       (mailbox --> *))
     
    266264
    267265(define-inline (%make-mailbox nm lm)
    268   (%raw-make-mailbox nm (%make-empty-queue lm) '()) )
     266  (%raw-make-mailbox nm (%make-limited-queue lm) '()) )
    269267
    270268(define (error-mailbox loc obj #!optional argnam)
     
    514512;; Mailbox Constructor
    515513
    516 (define (make-limited-mailbox #!optional lm (nm (gensym 'mailbox)))
    517   (%make-mailbox nm
    518     (cond
    519       ((not lm)     QUEUE-UNBUFFERED)
    520       ((fixnum? lm) lm)
    521       (else         QUEUE-UNLIMITED))) )
    522 
    523 (define (make-mailbox #!optional (nm (gensym 'mailbox)))
    524   (make-limited-mailbox #t nm) )
     514(define (make-limited-mailbox #!optional (lm #t) (nm (gensym 'mailbox)))
     515  (%make-mailbox nm lm) )
     516
     517(define (make-mailbox #!optional (nm (gensym 'mailbox)) (lm #f))
     518  (make-limited-mailbox lm nm) )
    525519
    526520(define (mailbox? obj)
Note: See TracChangeset for help on using the changeset viewer.