Skip to content

Commit 49e939a

Browse files
darcagnQuzarDC
authored andcommitted
Update __newlib_lock_acquire_recursive()
- Remove unnecessary irq enable/disable from __newlib_lock_acquire_recursive() - Update __newlib_lock_acquire_recursive() to use thd_get_current()
1 parent 2629afe commit 49e939a

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

kernel/libc/newlib/lock_common.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,7 @@ void __newlib_lock_close_recursive(__newlib_recursive_lock_t *lock) {
4545
}
4646

4747
void __newlib_lock_acquire_recursive(__newlib_recursive_lock_t *lock) {
48-
int old;
49-
int iscur;
50-
51-
// Check to see if we already own it. If so, everything is clear
52-
// to incr nest. Otherwise, we can safely go on to do a normal
53-
// spinlock wait.
54-
old = irq_disable();
55-
iscur = lock->owner == thd_current;
56-
irq_restore(old);
57-
58-
if(iscur) {
48+
if(lock->owner == thd_get_current()) {
5949
lock->nest++;
6050
return;
6151
}
@@ -64,7 +54,7 @@ void __newlib_lock_acquire_recursive(__newlib_recursive_lock_t *lock) {
6454
spinlock_lock(&lock->lock);
6555

6656
// We own it now, so it's safe to init the rest of this.
67-
lock->owner = thd_current;
57+
lock->owner = thd_get_current();
6858
lock->nest = 1;
6959
}
7060

0 commit comments

Comments
 (0)