Lines Matching refs:lock

4  * Module Name: utlock - Reader/Writer lock interfaces
21 * PARAMETERS: lock - Pointer to a valid RW lock
25 * DESCRIPTION: Reader/writer lock creation and deletion interfaces.
28 acpi_status acpi_ut_create_rw_lock(struct acpi_rw_lock *lock)
32 lock->num_readers = 0;
33 status = acpi_os_create_mutex(&lock->reader_mutex);
38 status = acpi_os_create_mutex(&lock->writer_mutex);
42 void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock)
45 acpi_os_delete_mutex(lock->reader_mutex);
46 acpi_os_delete_mutex(lock->writer_mutex);
48 lock->num_readers = 0;
49 lock->reader_mutex = NULL;
50 lock->writer_mutex = NULL;
58 * PARAMETERS: lock - Pointer to a valid RW lock
71 acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock)
75 status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER);
80 /* Acquire the write lock only for the first reader */
82 lock->num_readers++;
83 if (lock->num_readers == 1) {
85 acpi_os_acquire_mutex(lock->writer_mutex,
89 acpi_os_release_mutex(lock->reader_mutex);
93 acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock)
97 status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER);
102 /* Release the write lock only for the very last reader */
104 lock->num_readers--;
105 if (lock->num_readers == 0) {
106 acpi_os_release_mutex(lock->writer_mutex);
109 acpi_os_release_mutex(lock->reader_mutex);
118 * PARAMETERS: lock - Pointer to a valid RW lock
123 * release the writer mutex associated with the lock. Acquisition
124 * of the lock is fully exclusive and will block all readers and
129 acpi_status acpi_ut_acquire_write_lock(struct acpi_rw_lock *lock)
133 status = acpi_os_acquire_mutex(lock->writer_mutex, ACPI_WAIT_FOREVER);
137 void acpi_ut_release_write_lock(struct acpi_rw_lock *lock)
140 acpi_os_release_mutex(lock->writer_mutex);