kmutex | Key + Mutex = Kmutex | Data Processing library
kandi X-RAY | kmutex Summary
kandi X-RAY | kmutex Summary
Synchronization primitive that allows locking individual resources by unique ID. This is not a distributed lock. See golang.org/x/sync/singleflight if you want to reduce the number of calls to the same resource. Use kmutex if you want only one caller to use a resource at time. Kubernetes kmutex hashes keys to a fixed set of locks, and is useful if you do not always need a separate lock for each resource. Take a look at the implementation, it is very straight forward.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- New creates a new mutex
- Locker returns a lock for the given key .
- WithLock returns a new Kmutex
kmutex Key Features
kmutex Examples and Code Snippets
Community Discussions
Trending Discussions on kmutex
QUESTION
I'm porting a windows device driver to Mac OS X. The windows code uses KMUTEX. This is a recursive lock that can be acquired multiple times by the same thread. Other threads must wait to acquire it, but the acquisition will fail if the timeout occurs.
The I/O Kit's IORecursiveLock doesn't do timeouts. I can use BSD locks or Mach locks. The BSD part of the kernel offers condition variables with msleep() and wakeup().
I'm not clear if a condition variable will do what I want.
sem_timedwait(3) on BSD is in userspace.
Keith Shortridge provides a userspace set_timedwait implementation. One thread calls sem_wait() while another thread that sends a signal to the first if a timeout occurs.
I could port Shortridge's code to the kernel but I don't want to risk screwing it up. Google yields no other insight. Can you give me a clue?
...ANSWER
Answered 2017-Jul-06 at 15:10This link might be helpful, by the documentation this has what you need, maybe the method wait_result_tlck_mtx_sleep_deadline: https://developer.apple.com/library/content/documentation/Darwin/Conceptual/KernelProgramming/synchronization/synchronization.html#//apple_ref/doc/uid/TP30000905-CH218-BEHJDFCA
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install kmutex
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page