[interfacekit] BLooper implementation question
- From: "Erik Jaesler" <erik@xxxxxxxxxxxxxx>
- To: "interface kit team" <interfacekit@xxxxxxxxxxxxx>
- Date: Tue, 28 May 2002 01:50:32 -0700
This is really a nit-picky point, but I thought I'd throw it out there
anyway.
My testing of BLooper::IsMessageWaiting() makes me think that the
function not only checks whether the message queue is empty, but also if
there is anything waiting in the looper's port:
BLooper* Looper = new BLooper;
Looper->Run();
Looper->Lock(); // Prevents a port read
Looper->PostMessage('1234');
assert(Looper->MessageQueue()->IsEmpty());
assert(Looper->IsMessageWaiting());
Both asserts are successful. If, however, I do this:
BLooper Looper;
assert(!Looper.IsMessageWaiting());
the assert fails. My guess is that port_count() is returning an error
code (because the looper hasn't been run and, therefore, doesn't have a
valid port yet) and IsMessageWaiting() is only testing for != zero.
Anyway, the nit-picky question is: do I fix it or not? Seems like a
real corner case, but it is returning a bogus value.
Thanks,
e
Necessity is the plea for every infringement of human freedom. It is the
argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)
Other related posts:
- » [interfacekit] BLooper implementation question