Linux extraction locks and beacons are often used

Source: Internet
Author: User

1. Signal (synchronization between the two processes)struct semaphore Power_sem; Sema_init (&pdata->power_sem,1); down (&pdata->power_sem); up (&pdata->power_sem);


2. Mutually exclusive amount

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 Lock: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)); //equals above Wake_lock_timeout (&ec43_wlock, 10*hz); Wake_lock_destroy (&ec43_wlock);

Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Linux extraction locks and beacons are often used

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.