[合集] thread safe or not???# Programming - 葵花宝典
c*d
1 楼
☆─────────────────────────────────────☆
pxu (Lingua Franca) 于 (Wed Sep 20 16:23:26 2006) 提到:
Please take a look at following Pseudocode. I don't think
it's thread-safe. any ideas how to make it thread-safe?
class A
{
public:
A() : ptr(NULL) { };
void startup(B b, int i)
{
static C c(i);
ptr = &c;
b.dostuff(ptr);
}
private:
const C * ptr;
};
class B
{
public:
B() { };
/*
* value th
pxu (Lingua Franca) 于 (Wed Sep 20 16:23:26 2006) 提到:
Please take a look at following Pseudocode. I don't think
it's thread-safe. any ideas how to make it thread-safe?
class A
{
public:
A() : ptr(NULL) { };
void startup(B b, int i)
{
static C c(i);
ptr = &c;
b.dostuff(ptr);
}
private:
const C * ptr;
};
class B
{
public:
B() { };
/*
* value th