Embedding and thread safety are orthogonal, i.e. unrelated concepts.
Consider the following functions:
int factorial (const int n)
{
if (n <= 1)
{
return 1;
}
return factorial (n - 1);
}
This function cannot be built in as it is recursive, but it is perfectly protected by a stream.
int factorial_2 (int n)
{
int Result = 1;
while (n> 1)
{
Result * = n--;
}
return Result;
}
This function can be built into the compiler and is still perfectly protected by the stream.
int RefCount;
void DecRef ()
{
--RefCount;
}
This function is not thread safe, regardless of whether its compiler is connected or not.
Tobias
source share