* More sophisticated debug output macro.

* Fixed BLooper::ReadMessageFromPort(). If ReadRawFromPort() failed,
  there was nevertheless a message created and dispatched.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10738 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-01-15 00:28:58 +00:00
parent c98d79095b
commit bcab07add0

View File

@ -40,6 +40,17 @@
#define DBG(x) ; #define DBG(x) ;
#define PRINT(x) DBG({ printf("[%6ld] ", find_thread(NULL)); printf x; }) #define PRINT(x) DBG({ printf("[%6ld] ", find_thread(NULL)); printf x; })
/*
#include <Autolock.h>
#include <Locker.h>
static BLocker sDebugPrintLocker("BLooper debug print");
#define PRINT(x) DBG({ \
BAutolock _(sDebugPrintLocker); \
debug_printf("[%6ld] ", find_thread(NULL)); \
debug_printf x; \
})
*/
// Standard Includes ----------------------------------------------------------- // Standard Includes -----------------------------------------------------------
#include <stdio.h> #include <stdio.h>
@ -1247,13 +1258,12 @@ PRINT(("BLooper::ReadMessageFromPort()\n"));
BMessage* bmsg; BMessage* bmsg;
void* msgbuffer = ReadRawFromPort(&msgcode, tout); void* msgbuffer = ReadRawFromPort(&msgcode, tout);
if (!msgbuffer)
return NULL;
bmsg = ConvertToMessage(msgbuffer, msgcode); bmsg = ConvertToMessage(msgbuffer, msgcode);
if (msgbuffer)
{
delete[] (int8*)msgbuffer; delete[] (int8*)msgbuffer;
}
PRINT(("BLooper::ReadMessageFromPort() done: %p\n", bmsg)); PRINT(("BLooper::ReadMessageFromPort() done: %p\n", bmsg));
return bmsg; return bmsg;