Johan M
May 31st, 1999, 04:49 AM
Hello!
I have a program which has one array which must be shared between multiple resources. The structure
of the code looks like this:
// container for various information
class OtherClass
{
public:
CString name, ..., ..., ..;
};
// holds member functions to add / remove / retrieve info from OtherClass
class MyClass : public OtherClass
{
public:
add_class (CString*, ..., ..., ..);
remove_class(CString*);
private:
OtherClass *array[1000];
};
The problem is that sometimes, the array in MyClass must be protected from modification.
Example: While using add_class( ), remove_class( ) must wait until add_class has finished it's
modifications.
I have heard about CSingleLock(CSyncObject*, BOOL); and I think it might be the solution.
But how do I create a CSingleLock object out of OtherClass *array[1000]; ?
/ Johan M
I have a program which has one array which must be shared between multiple resources. The structure
of the code looks like this:
// container for various information
class OtherClass
{
public:
CString name, ..., ..., ..;
};
// holds member functions to add / remove / retrieve info from OtherClass
class MyClass : public OtherClass
{
public:
add_class (CString*, ..., ..., ..);
remove_class(CString*);
private:
OtherClass *array[1000];
};
The problem is that sometimes, the array in MyClass must be protected from modification.
Example: While using add_class( ), remove_class( ) must wait until add_class has finished it's
modifications.
I have heard about CSingleLock(CSyncObject*, BOOL); and I think it might be the solution.
But how do I create a CSingleLock object out of OtherClass *array[1000]; ?
/ Johan M