eventcount.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Mach Operating System
  3. * Copyright (c) 1993-1987 Carnegie Mellon University
  4. * All Rights Reserved.
  5. *
  6. * Permission to use, copy, modify and distribute this software and its
  7. * documentation is hereby granted, provided that both the copyright
  8. * notice and this permission notice appear in all copies of the
  9. * software, derivative works or modified versions, and any portions
  10. * thereof, and that both notices appear in supporting documentation.
  11. *
  12. * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13. * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14. * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15. *
  16. * Carnegie Mellon requests users of this software to return to
  17. *
  18. * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
  19. * School of Computer Science
  20. * Carnegie Mellon University
  21. * Pittsburgh PA 15213-3890
  22. *
  23. * any improvements or extensions that they make and grant Carnegie Mellon
  24. * the rights to redistribute these changes.
  25. */
  26. /*
  27. * File: eventcount.c
  28. * Author: Alessandro Forin
  29. * Date: 10/91
  30. *
  31. * Eventcounters, for user-level drivers synchronization
  32. *
  33. */
  34. #ifndef _KERN_EVENTCOUNT_H_
  35. #define _KERN_EVENTCOUNT_H_ 1
  36. /* kernel visible only */
  37. typedef struct evc {
  38. int count;
  39. thread_t waiting_thread;
  40. natural_t ev_id;
  41. struct evc *sanity;
  42. decl_simple_lock_data(, lock)
  43. } *evc_t;
  44. extern void evc_init(evc_t ev),
  45. evc_destroy(evc_t ev),
  46. evc_signal(evc_t ev),
  47. evc_notify_abort(thread_t thread);
  48. /* kernel and user visible */
  49. extern kern_return_t evc_wait(natural_t ev_id);
  50. extern kern_return_t evc_wait_clear(natural_t ev_id);
  51. #if NCPUS <= 1
  52. void simpler_thread_setrun(
  53. thread_t th,
  54. boolean_t may_preempt);
  55. #endif
  56. #endif /* _KERN_EVENTCOUNT_H_ */