* get_context() didn't quite do what it was supposed to be doing. Especially,
it was not guaranteed that this function returned a valid context even with low memory. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28826 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2008, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2003-2008, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -67,9 +67,7 @@ get_context()
|
|||||||
return &sTeamContext;
|
return &sTeamContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
*tls_address(slot) = allocate_context();
|
|
||||||
sThreadContextSlot = slot;
|
sThreadContextSlot = slot;
|
||||||
return (syslog_context *)tls_get(slot);
|
|
||||||
} else {
|
} else {
|
||||||
while (sThreadContextSlot == -1)
|
while (sThreadContextSlot == -1)
|
||||||
snooze(10000);
|
snooze(10000);
|
||||||
@@ -81,7 +79,7 @@ get_context()
|
|||||||
// try to allocate the context again; it might have
|
// try to allocate the context again; it might have
|
||||||
// been deleted, or there was not enough memory last
|
// been deleted, or there was not enough memory last
|
||||||
// time
|
// time
|
||||||
context = allocate_context();
|
*tls_address(sThreadContextSlot) = context = allocate_context();
|
||||||
}
|
}
|
||||||
if (context != NULL)
|
if (context != NULL)
|
||||||
return context;
|
return context;
|
||||||
|
|||||||
Reference in New Issue
Block a user