First baby step towards a lockless get_memory_map(): vm_get_current_user_address_space()

no longer needs to lock address space hash table - that also makes the lookup much
faster, too (and a direct pointer is used instead of a hash lookup).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17246 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-04-27 17:46:19 +00:00
parent fe2b2c822f
commit 11add5a5d7

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -200,7 +200,17 @@ vm_kernel_address_space_id(void)
vm_address_space *
vm_get_current_user_address_space(void)
{
return vm_get_address_space_by_id(vm_current_user_address_space_id());
struct thread *thread = thread_get_current_thread();
if (thread != NULL) {
vm_address_space *addressSpace = thread->team->address_space;
if (addressSpace != NULL) {
atomic_add(&addressSpace->ref_count, 1);
return addressSpace;
}
}
return NULL;
}