Z
Zerex71
Greetings group,
I am stumped by the following situation: I completed a phase in coding
my design in C# and all was smooth as silk, until I began the
conversion to C++ for an embedded non-M$ platform (RHEL box). The
problem I am running into is the following: I just want to convert the
C# lock(this) statement into C++ but no matter what I do, the compiler
balks. I am using MS VS2005. Here's the long and short of it:
#include <msclr\lock.h>
using namespace msclr; // Also set /clr compile option in the project
properties
// Inside my class' .cpp
void MyClass::flush()
{
// Method serves to do one thing and one thing only - clear both
queues
lock(this); // *** offending LOC
while (!incomingQueue.empty()) incomingQueue.pop();
while (!outgoingQueue.empty())) outgoingQueue.pop();
}
I get a complaint by the compiler that msclr::lock does not have a
copy constructor (like I care, right?). I just want to do the
conversion and be on with life. It's been about 3 years since I've
done C++ and looking at some of the converted code (I used a free tool
online to get me going), it put a whole bunch of other looks-legit-but-
I-have-no-idea-or-even-care stuff in my files. I don't think this
should be a difficult task. Perhaps I'm forgetting something because
lock (defined in lock.h) is a template class, but I just want to shut
the compiler up and move on with life.
Thanks in advance for any help you can provide.
Mike
I am stumped by the following situation: I completed a phase in coding
my design in C# and all was smooth as silk, until I began the
conversion to C++ for an embedded non-M$ platform (RHEL box). The
problem I am running into is the following: I just want to convert the
C# lock(this) statement into C++ but no matter what I do, the compiler
balks. I am using MS VS2005. Here's the long and short of it:
#include <msclr\lock.h>
using namespace msclr; // Also set /clr compile option in the project
properties
// Inside my class' .cpp
void MyClass::flush()
{
// Method serves to do one thing and one thing only - clear both
queues
lock(this); // *** offending LOC
while (!incomingQueue.empty()) incomingQueue.pop();
while (!outgoingQueue.empty())) outgoingQueue.pop();
}
I get a complaint by the compiler that msclr::lock does not have a
copy constructor (like I care, right?). I just want to do the
conversion and be on with life. It's been about 3 years since I've
done C++ and looking at some of the converted code (I used a free tool
online to get me going), it put a whole bunch of other looks-legit-but-
I-have-no-idea-or-even-care stuff in my files. I don't think this
should be a difficult task. Perhaps I'm forgetting something because
lock (defined in lock.h) is a template class, but I just want to shut
the compiler up and move on with life.
Thanks in advance for any help you can provide.
Mike