-
Notifications
You must be signed in to change notification settings - Fork 40
Add resident device change call #1517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 49 commits
e5d8739
8c54695
064d1ac
c4a7499
588d1af
b24574c
5983cfa
5cbbad2
c27407a
53ec753
01d74ba
0bc9a29
d13a3ef
272bd66
cabd5e7
7de5b15
32ebea7
50db5c5
780794c
4f75bca
9f1c588
3f4db4f
cf4254a
7bd5c24
dbb8298
58fae70
53bfcb0
822f278
340bfb1
fad510c
636477a
a6e456e
877a36e
6b0e070
0498da7
e9ccf45
d30da26
29a706d
5713a96
134e16b
5adb37c
058bf8d
4803c47
a3cc32e
5b7f61a
0bf7cbd
e0af7eb
57acba7
56c9e9a
838451c
d9dba48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1094,7 +1094,8 @@ int critnib_find(struct critnib *c, uintptr_t key, enum find_dir_t dir, | |
* | ||
* If func() returns non-zero, the search is aborted. | ||
*/ | ||
static int iter(struct critnib_node *__restrict n, word min, word max, | ||
static int iter(struct critnib_node *__restrict n, const word min, | ||
const word max, | ||
int (*func)(word key, void *value, void *privdata), | ||
void *privdata) { | ||
if (is_leaf(n)) { | ||
|
@@ -1129,9 +1130,21 @@ static int iter(struct critnib_node *__restrict n, word min, word max, | |
void critnib_iter(critnib *c, uintptr_t min, uintptr_t max, | ||
int (*func)(uintptr_t key, void *value, void *privdata), | ||
void *privdata) { | ||
bool wasIterating = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move lock inside if - then you can just add else to if instead extra variable. This will make it a lite bit easier to read. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, because I want to access root in |
||
utils_mutex_lock(&c->mutex); | ||
if (c->root) { | ||
iter(c->root, min, max, func, privdata); | ||
wasIterating = true; | ||
} | ||
utils_mutex_unlock(&c->mutex); | ||
if (!wasIterating) { | ||
LOG_DEBUG("there was no root, iterating critnib: %p was skipped", | ||
(void *)c); | ||
} | ||
} | ||
|
||
void critnib_iter_all(critnib *c, | ||
int (*func)(uintptr_t key, void *value, void *privdata), | ||
void *privdata) { | ||
critnib_iter(c, 0, (uintptr_t)-1, func, privdata); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because comment string a few lines earlier uses pool name