Anyone have any idea why someone would do this? (mtxScrub is a mutex handle....)
Anyone have any idea why someone would do this? (mtxScrub is a mutex handle....)
destructor TDataServer.Destroy;
var
ii : integer;
begin
for ii:=1 to 100 do
begin
try
CloseHandle(mtxScrub);
break;
except
sleep(100);
end;
end;
inherited Destroy;
end;
destructor TDataServer.Destroy;
var
ii : integer;
begin
for ii:=1 to 100 do
begin
try
CloseHandle(mtxScrub);
break;
except
sleep(100);
end;
end;
inherited Destroy;
end;
Because they are a plank? Its obvious they gave it 100 tries to close the mutex, seems excessive..... Just a bit
ReplyDeletePerhaps the Mutex is held by another thread, and you are waiting to give it a fair chance to end before you move on?
ReplyDeleteSlow afternoon, nothing better to do?
ReplyDeleteThat! Is! Awesome!
ReplyDeleteIt should, but it can't if it is held - hence the exception handling. Hard to understand the motivation for this, without knowing the whole picture. I wonder, is there another piece of code with a try/except around that mutex somewhere? Edit: A lot of issues with threads that have concurrency, is about the chicken vs the egg story. Who got there first?
ReplyDelete