1.信号( 这两个过程之间的同步)
struct semaphore power_sem;
sema_init(&pdata->power_sem,1);
down(&pdata->power_sem);
up(&pdata->power_sem);
2.相互排斥量
struct mutex led_mutex;
mutex_init(&led_mutex);
mutex_lock(&led_mutex);
while(t--);// for delay
mutex_unlock(&led_mutex);
mutex_destroy(&led_mutex);
3.wakup锁:
static struct wake_lock ec43_wlock;
wake_lock_init(&ec43_wlock, WAKE_LOCK_SUSPEND, "ec43_wakelock");
wake_lock_timeout(&ec43_wlock, msecs_to_jiffies(10*1000));
//等于上面 wake_lock_timeout(&ec43_wlock, 10*HZ);
wake_lock_destroy(&ec43_wlock);
版权声明:本文博客原创文章,博客,未经同意,不得转载。