Rev 1583 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1583 | Rev 1586 | ||
---|---|---|---|
Line 305... | Line 305... | ||
305 | } |
305 | } |
306 | 306 | ||
307 | /** Remove references from futexes known to the current task. */ |
307 | /** Remove references from futexes known to the current task. */ |
308 | void futex_cleanup(void) |
308 | void futex_cleanup(void) |
309 | { |
309 | { |
- | 310 | link_t *cur; |
|
- | 311 | ||
- | 312 | rwlock_write_lock(&futex_ht_lock); |
|
- | 313 | mutex_lock(&TASK->futexes_lock); |
|
- | 314 | ||
- | 315 | for (cur = TASK->futexes.leaf_head.next; cur != &TASK->futexes.leaf_head; cur = cur->next) { |
|
- | 316 | btree_node_t *node; |
|
- | 317 | int i; |
|
- | 318 | ||
- | 319 | node = list_get_instance(cur, btree_node_t, leaf_link); |
|
- | 320 | for (i = 0; i < node->keys; i++) { |
|
- | 321 | futex_t *ftx; |
|
- | 322 | __address paddr = node->key[i]; |
|
- | 323 | ||
- | 324 | ftx = (futex_t *) node->value[i]; |
|
- | 325 | if (--ftx->refcount == 0) |
|
- | 326 | hash_table_remove(&futex_ht, &paddr, 1); |
|
- | 327 | } |
|
- | 328 | } |
|
- | 329 | ||
- | 330 | mutex_unlock(&TASK->futexes_lock); |
|
- | 331 | rwlock_write_unlock(&futex_ht_lock); |
|
310 | } |
332 | } |