thread_notify.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * arch/arm/include/asm/thread_notify.h
  3. *
  4. * Copyright (C) 2006 Russell King.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef ASMARM_THREAD_NOTIFY_H
  11. #define ASMARM_THREAD_NOTIFY_H
  12. #ifdef __KERNEL__
  13. #ifndef __ASSEMBLY__
  14. #include <linux/notifier.h>
  15. #include <asm/thread_info.h>
  16. static inline int thread_register_notifier(struct notifier_block *n)
  17. {
  18. extern struct atomic_notifier_head thread_notify_head;
  19. return atomic_notifier_chain_register(&thread_notify_head, n);
  20. }
  21. static inline void thread_unregister_notifier(struct notifier_block *n)
  22. {
  23. extern struct atomic_notifier_head thread_notify_head;
  24. atomic_notifier_chain_unregister(&thread_notify_head, n);
  25. }
  26. static inline void thread_notify(unsigned long rc, struct thread_info *thread)
  27. {
  28. extern struct atomic_notifier_head thread_notify_head;
  29. atomic_notifier_call_chain(&thread_notify_head, rc, thread);
  30. }
  31. #endif
  32. /*
  33. * These are the reason codes for the thread notifier.
  34. */
  35. #define THREAD_NOTIFY_FLUSH 0
  36. #define THREAD_NOTIFY_EXIT 1
  37. #define THREAD_NOTIFY_SWITCH 2
  38. #define THREAD_NOTIFY_COPY 3
  39. #endif
  40. #endif