Skip to content
This repository
Browse code

Able to disable thread self.

  • Loading branch information...
commit bcd49b94dd314c1c742d7b6719f884d52e6a1c40 1 parent 422754f
steve authored

Showing 1 changed file with 13 additions and 4 deletions. Show diff stats Hide diff stats

  1. +13 4 vvp/vthread.cc
17 vvp/vthread.cc
@@ -17,7 +17,7 @@
17 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 18 */
19 19 #if !defined(WINNT)
20   -#ident "$Id: vthread.cc,v 1.72 2002/05/24 04:55:13 steve Exp $"
  20 +#ident "$Id: vthread.cc,v 1.73 2002/05/27 00:53:10 steve Exp $"
21 21 #endif
22 22
23 23 # include "vthread.h"
@@ -622,6 +622,8 @@ bool of_DISABLE(vthread_t thr, vvp_code_t cp)
622 622
623 623 struct vthread_s*head = scope->threads;
624 624
  625 + bool disabled_myself_flag = false;
  626 +
625 627 while (head->scope_next != head) {
626 628 vthread_t tmp = head->scope_next;
627 629
@@ -631,10 +633,14 @@ bool of_DISABLE(vthread_t thr, vvp_code_t cp)
631 633
632 634 /* XXXX I don't support disabling threads with children. */
633 635 assert(tmp->child == 0);
634   - assert(tmp != thr);
635   - /* XXXX Not supported yet. */
  636 + /* XXXX Don't know how to disable waiting threads. */
636 637 assert(tmp->waiting_for_event == 0);
637 638
  639 + /* If I am disabling myself, that remember that fact so
  640 + that I can finish this statement differently. */
  641 + if (tmp == thr)
  642 + disabled_myself_flag = true;
  643 +
638 644 tmp->pc = 0;
639 645 tmp->i_have_ended = 1;
640 646
@@ -655,7 +661,7 @@ bool of_DISABLE(vthread_t thr, vvp_code_t cp)
655 661 }
656 662 }
657 663
658   - return true;
  664 + return ! disabled_myself_flag;
659 665 }
660 666
661 667 static void divide_bits(unsigned len, unsigned char*lbits,
@@ -1907,6 +1913,9 @@ bool of_CALL_UFUNC(vthread_t thr, vvp_code_t cp)
1907 1913
1908 1914 /*
1909 1915 * $Log: vthread.cc,v $
  1916 + * Revision 1.73 2002/05/27 00:53:10 steve
  1917 + * Able to disable thread self.
  1918 + *
1910 1919 * Revision 1.72 2002/05/24 04:55:13 steve
1911 1920 * Detect long division by zero.
1912 1921 *

0 comments on commit bcd49b9

Please sign in to comment.
Something went wrong with that request. Please try again.