* 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:
Axel Dörfler 2008-12-27 22:12:08 +00:00
parent d68ffdedc0
commit bf6bf2e36b

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
@ -67,9 +67,7 @@ get_context()
return &sTeamContext;
}
*tls_address(slot) = allocate_context();
sThreadContextSlot = slot;
return (syslog_context *)tls_get(slot);
} else {
while (sThreadContextSlot == -1)
snooze(10000);
@ -81,7 +79,7 @@ get_context()
// try to allocate the context again; it might have
// been deleted, or there was not enough memory last
// time
context = allocate_context();
*tls_address(sThreadContextSlot) = context = allocate_context();
}
if (context != NULL)
return context;