Re: I just want to lock() - is that so wrong?
On 26 mar, 15:09, Zerex71 <mfeher1...@gmail.com> wrote:
On Mar 25, 7:55 pm, Martin York <Martin.YorkAma...@gmail.com> wrote:
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();
}
Try:
lock myObjectLocker(this); // *** offending LOC
You know, I tried that, and it didn't work for me. That is
similar to both of the LOCs I have seen in the MSDN and other
online examples, and it still didn't work.
Until we know how lock is declared, we can't say. There is no
function "lock" in C++, nor any type lock, nor anything else.
It's a user defined symbol, and without knowing how it's
defined, it's impossible to say why the compiler is complaining.
I've even tried "lock myLock = new lock(this)" or lock
l<MyClass> or things or that nature.
The technique of randomly changing code until it manages to get
through the compiler is not one I'd recommend for robust code.
None of it works. This lock.h, which is part of the MS CLR
(as evidenced by the namespace)
What namespace?
is not something some Joe Blow cooked up - it's
part of the native VS2005 package. I don't know where else to
turn.
If it's part of the system libraries for Windows, then a Windows
newsgroup would seem appropriate, no?
And, while we're on the topic of what's on topic, tell me
again why a poster wouldn't want to post a C++-related thread
on a newsgroup that is called "comp.lang.c++".
Well, without seeing the declaration of lock, who knows whether
the question is C++ related or not. I can't reproduce it with
my compilers on my machines, because I don't have the
corresponding headers. Show me what's in the headers, and I can
have a stab at it.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34