Created
March 16, 2015 04:16
-
-
Save jsbattig/88d7525f112eb587bc47 to your computer and use it in GitHub Desktop.
Sample test that will break fiber utilization in Delphi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure TestTJobQueue.JobMethodRaiseAndSwitchToFiber(const AJob: IJob; const AParams: array of Variant); | |
begin | |
try | |
Check(True); | |
raise ETestJobQueue.Create('Hello'); | |
except | |
on E : Exception do | |
begin | |
try | |
raise ETestJobQueue.Create('Hello Nested'); | |
except | |
on E : Exception do | |
begin | |
try | |
raise ETestJobQueue.Create('Hello More Nested'); | |
except | |
on E : Exception do | |
begin | |
AJob.Sleep(400); // <-- This call will perform a SwitchToFiber() to emulate a blocking wait | |
CheckEqualsString('Hello More Nested', E.Message); | |
end; | |
end; | |
CheckEqualsString('Hello Nested', E.Message); | |
end; | |
end; | |
CheckEqualsString('Hello', E.Message); | |
end; | |
end; | |
Check(True); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment