scsh-checkins
[Top] [All Lists]

[Scsh-checkins] CVS: scsh-0.6/scheme/rts thread.scm,1.3,1.4

To: scsh-checkins@lists.sourceforge.net
Subject: [Scsh-checkins] CVS: scsh-0.6/scheme/rts thread.scm,1.3,1.4
From: Martin Gasbichler <mainzelm@users.sourceforge.net>
Date: Thu Oct 4 04:17:03 2001
List-id: <scsh-checkins.lists.sourceforge.net>
Sender: scsh-checkins-admin@lists.sourceforge.net
Update of /cvsroot/scsh/scsh-0.6/scheme/rts
In directory usw-pr-cvs1:/tmp/cvs-serv9293/scheme/rts

Modified Files:
        thread.scm 
Log Message:
A thread may life in multiple queues.


Index: thread.scm
===================================================================
RCS file: /cvsroot/scsh/scsh-0.6/scheme/rts/thread.scm,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** thread.scm  2001/05/28 13:31:01     1.3
--- thread.scm  2001/10/04 11:16:15     1.4
***************
*** 43,47 ****
                      cell-values own-cell-values?
                      continuation scheduler
!                     queue arguments
                      events current-task uid name)
    thread?
--- 43,47 ----
                      cell-values own-cell-values?
                      continuation scheduler
!                     queues arguments
                      events current-task uid name)
    thread?
***************
*** 55,59 ****
    (own-cell-values? thread-own-cell-values? set-thread-own-values?!)
    (continuation   thread-continuation set-thread-continuation!)
!   (queue          thread-queue set-thread-queue!)
    (arguments      thread-arguments set-thread-arguments!)
    (time           thread-time set-thread-time!)
--- 55,59 ----
    (own-cell-values? thread-own-cell-values? set-thread-own-values?!)
    (continuation   thread-continuation set-thread-continuation!)
!   (queues         thread-queues set-thread-queues!)
    (arguments      thread-arguments set-thread-arguments!)
    (time           thread-time set-thread-time!)
***************
*** 174,193 ****
  
  (define (enqueue-thread! queue thread)
!   (if (thread-queue thread)
        (error "enqueued thread being added to another queue" thread queue))
!   (set-thread-queue! thread queue)
    (enqueue! queue thread))
  
  (define (dequeue-thread! queue)
    (let ((thread (dequeue! queue)))
!     (set-thread-queue! thread #f)
      thread))
  
! (define (remove-thread-from-queue! thread)
!   (if (thread-queue thread)
        (begin
!       (delete-from-queue! (thread-queue thread) thread)
!       (set-thread-queue! thread #f))))
! 
  ;----------------
  
--- 174,199 ----
  
  (define (enqueue-thread! queue thread)
!   (if (thread-queues thread)
        (error "enqueued thread being added to another queue" thread queue))
!   (set-thread-queues! thread (list queue))
    (enqueue! queue thread))
  
+ (define (multiple-enqueue-thread! queues thread)
+   (if (thread-queues thread)
+       (error "enqueued thread being added to another queue" thread queues))
+   (set-thread-queues! thread queues)
+   (for-each (lambda (q) (enqueue! q thread)) queues))
+ 
  (define (dequeue-thread! queue)
    (let ((thread (dequeue! queue)))
!     (for-each (lambda (q) (delete-from-queue! q thread)) (thread-queues 
thread))
!     (set-thread-queues! thread #f)
      thread))
  
! (define (remove-thread-from-queues! thread)
!   (if (thread-queues thread)
        (begin
!       (for-each (lambda (q) (delete-from-queue! q thread)) (thread-queues 
thread))
!       (set-thread-queues! thread #f))))
  ;----------------
  
***************
*** 240,245 ****
           (enable-interrupts!)
           (error "thread run by wrong scheduler" thread scheduler))
!         ((thread-queue thread)
           (enable-interrupts!)
           (error "thread run while still on a queue" thread))
          ((and (thread-current-task thread)
--- 246,255 ----
           (enable-interrupts!)
           (error "thread run by wrong scheduler" thread scheduler))
!         ((thread-queues thread)
           (enable-interrupts!)
+          (apply debug-message (list "thread run while still on a queue " 
+                                     (thread-uid thread)
+                                     (thread-name thread)
+                                     (thread-queues thread)))
           (error "thread run while still on a queue" thread))
          ((and (thread-current-task thread)
***************
*** 578,582 ****
  
  (define (make-ready thread . args)
!   (if (thread-queue thread)
        (error "trying to schedule a queued thread" thread))
  ;  (if (not (null? (thread-arguments thread)))
--- 588,592 ----
  
  (define (make-ready thread . args)
!   (if (thread-queues thread)
        (error "trying to schedule a queued thread" thread))
  ;  (if (not (null? (thread-arguments thread)))



<Prev in Thread] Current Thread [Next in Thread>
  • [Scsh-checkins] CVS: scsh-0.6/scheme/rts thread.scm,1.3,1.4, Martin Gasbichler <=