smplock.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *  include/asm-s390/smplock.h
  3.  *
  4.  *  S390 version
  5.  *
  6.  *  Derived from "include/asm-i386/smplock.h"
  7.  */
  8. #include <linux/interrupt.h>
  9. #include <linux/spinlock.h>
  10. extern spinlock_t kernel_flag;
  11. #define kernel_locked()                spin_is_locked(&kernel_flag)
  12. /*
  13.  * Release global kernel lock and global interrupt lock
  14.  */
  15. #define release_kernel_lock(task, cpu)     
  16. do {                                       
  17. if (task->lock_depth >= 0)         
  18. spin_unlock(&kernel_flag); 
  19. release_irqlock(cpu);              
  20. __sti();                           
  21. } while (0)
  22. /*
  23.  * Re-acquire the kernel lock
  24.  */
  25. #define reacquire_kernel_lock(task)        
  26. do {                                       
  27. if (task->lock_depth >= 0)         
  28. spin_lock(&kernel_flag);   
  29. } while (0)
  30. /*
  31.  * Getting the big kernel lock.
  32.  *
  33.  * This cannot happen asynchronously,
  34.  * so we only need to worry about other
  35.  * CPU's.
  36.  */
  37. /*
  38.  * Getting the big kernel lock.
  39.  *
  40.  * This cannot happen asynchronously,
  41.  * so we only need to worry about other
  42.  * CPU's.
  43.  */
  44. extern __inline__ void lock_kernel(void)
  45. {
  46.         if (!++current->lock_depth)
  47.                 spin_lock(&kernel_flag);
  48. }
  49. extern __inline__ void unlock_kernel(void)
  50. {
  51.         if (--current->lock_depth < 0)
  52.                 spin_unlock(&kernel_flag);
  53. }