is it possible to make use of NameThreadForDebugging/NameThread functions for any background thread created by Odac, e.g. DBMonitor send thread?
This would be a nice feature for debugging programs using Odac.
Here is a code snippet:
Code: Select all
type
tagTHREADNAME_INFO = record
dwType : LongWord; // Must be 0x1000.
szName : PAnsiChar; // Pointer to name (in user addr space).
dwThreadId : LongWord; // Thread ID (-1=caller thread).
dwFlags : LongWord; // Reserved for future use, must be zero.
end;
procedure NameThreadForDebugging (threadId: dword; threadName: AnsiString);
const
MS_VC_EXCEPTION = $406D1388;
{$ifdef VER7P} var tni : tagTHREADNAME_INFO; {$endif}
begin
{$ifdef VER7P}
if (threadName '') and (DebugHook 0) then begin
tni.dwType := $1000;
tni.szName := PAnsiChar(threadName);
tni.dwThreadID := threadID;
tni.dwFlags := 0;
try
RaiseException(MS_VC_EXCEPTION, 0, SizeOf(tni) div SizeOf(LongWord), @tni);
except end;
end;
{$endif}
end;
Code: Select all
NameThreadForDebugging($FFFFFFFF, 'DBMonitor send thread')