MacGyverS2000
Programmer
I've come across a sticky wicket. I inherited a spaghetti code program that had four mutexes spelled out explicitly.
In the public section of the class:
With the following empty constructor:
As the program will continue to increase in scope, I'm attempting to shortcut as much as possible by placing them into arrays.
The new mutex declaration:
It's the constructor I'm having issue with. I've tried the following:
All are obviously incorrect (else this thread would be pointless). As I thought about it, though, I could not come up with any valid reason why the mutexes would need to be explicitly listed in the constructor in the first place.
So, I simply ended up with:
And I don't seem to have any issues.
Thoughts?
In the public section of the class:
Code:
CMutex Mut1;
CMutex Mut2;
CMutex Mut3;
CMutex Mut4;
With the following empty constructor:
Code:
CFoo::CFoo():Mut1(FALSE, NULL, &Security),
Mut2(FALSE, NULL, &Security),
Mut3(FALSE, NULL, &Security),
Mut4(FALSE, NULL, &Security)
{}
As the program will continue to increase in scope, I'm attempting to shortcut as much as possible by placing them into arrays.
The new mutex declaration:
Code:
Cmutex Mut[CONSTANT1][CONSTANT2];
It's the constructor I'm having issue with. I've tried the following:
Code:
CFoo::CFoo():Mut[CONSTANT1][CONSTANT2](FALSE, NULL, &Security)
{}
CFoo::CFoo():Mut[0][0](FALSE, NULL, &Security),
Mut[0][1](FALSE, NULL, &Security),
Mut[1][0](FALSE, NULL, &Security),
Mut[1][1](FALSE, NULL, &Security)
{}
CFoo::CFoo():Mut[][](FALSE, NULL, &Security)
{}
CFoo::CFoo():Mut(FALSE, NULL, &Security)
{}
So, I simply ended up with:
Code:
CFoo::CFoo()
{}
Thoughts?