shuttle.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 1993,1994 The University of Utah and
  3. * the Computer Systems Laboratory (CSL). All rights reserved.
  4. *
  5. * Permission to use, copy, modify and distribute this software and its
  6. * documentation is hereby granted, provided that both the copyright
  7. * notice and this permission notice appear in all copies of the
  8. * software, derivative works or modified versions, and any portions
  9. * thereof, and that both notices appear in supporting documentation.
  10. *
  11. * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
  12. * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
  13. * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  14. *
  15. * CSL requests users of this software to return to csl-dist@cs.utah.edu any
  16. * improvements that they make and grant CSL redistribution rights.
  17. *
  18. * Author: Bryan Ford, University of Utah CSL
  19. */
  20. /*
  21. * File: shuttle.h
  22. * Author: Bryan Ford
  23. *
  24. * This file contains definitions for shuttles,
  25. * which handle microscheduling for individual threads.
  26. *
  27. */
  28. #ifndef _KERN_SHUTTLE_H_
  29. #define _KERN_SHUTTLE_H_
  30. #include <kern/lock.h>
  31. struct Shuttle {
  32. /* XXX must be first in thread */
  33. /*
  34. * NOTE: The runq field in the thread structure has an unusual
  35. * locking protocol. If its value is RUN_QUEUE_NULL, then it is
  36. * locked by the thread_lock, but if its value is something else
  37. * (i.e. a run_queue) then it is locked by that run_queue's lock.
  38. */
  39. queue_chain_t links; /* current run queue links */
  40. run_queue_t runq; /* run queue p is on SEE BELOW */
  41. /* Next pointer when on a queue */
  42. struct Shuttle *next;
  43. /* Micropriority level */
  44. int priority;
  45. /* General-purpose pointer field whose use depends on what the
  46. thread happens to be doing */
  47. void *message;
  48. int foobar[1];
  49. };
  50. typedef struct Shuttle Shuttle;
  51. /* Exported functions */
  52. /* Machine-dependent code must define the following functions */
  53. #endif /* _KERN_SHUTTLE_H_ */