-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Trying to run a C++ program, I get segmentation
faults which appear to be specific to NetBSD. Bert Hubert wrote the
simple test program (at the end of this message) and, indeed, it crashes only on NetBSD.
% uname -a
NetBSD golgoth 5.0.1 NetBSD 5.0.1 (GENERIC) #0: Thu Oct 1 15:46:16 CEST 2009
+stephane@golgoth:/usr/obj/sys/arch/i386/compile/GENERIC…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
__thread Foo foo;
How is "foo" actually resolved? Does the compiler silently replace every instance of "foo" with a function call? Is "foo" stored somewhere relative to the bottom of the stack, and the compiler stores this as "hey, for each thread, have this space near the bottom of the stack, and…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm working on a custom mark-release style memory allocator for the D programming language that works by allocating from thread-local regions. It seems that the thread local storage bottleneck is causing a huge (~50%) slowdown in allocating memory from these regions compared to an otherwise identical…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
In c#, each thread has its own stack space.
If this is the case, why is the following code not thread-safe? (It is stated that this code is thread-safe on this post: Locking in C#
class Foo
{
private int count = 0;
public void TrySomething()
{
count++;
}
}
As…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm working on a project where we mix .NET code and native C++ code via a C++/CLI layer. In this solution I want to use Thread Local Storage via the __declspec(thread) declaration:
__declspec(thread) int lastId = 0;
However, at the first access of the variable, I get a NullReferenceException.
To…
>>> More