Optimized current_team() - it now uses a static variable to hold the team ID.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19964 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-01-26 12:05:10 +00:00
parent fa9e26cdd0
commit 88df8322a9
+10 -8
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2005, Haiku.
* Copyright 2001-2007, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,14 +7,14 @@
*/
#include <string.h>
#include <sys/utsname.h>
#include <AppMisc.h>
#include <Entry.h>
#include <image.h>
#include <OS.h>
#include <string.h>
#include <sys/utsname.h>
namespace BPrivate {
@@ -117,10 +117,12 @@ get_app_ref(entry_ref *ref, bool traverse)
team_id
current_team()
{
team_id team = -1;
thread_info info;
if (get_thread_info(find_thread(NULL), &info) == B_OK)
team = info.team;
static team_id team = -1;
if (team < 0) {
thread_info info;
if (get_thread_info(find_thread(NULL), &info) == B_OK)
team = info.team;
}
return team;
}