I'm building a Brook 5 Framework app, in which, some of the threads will be very slow to execute, so they need to be isolated. I am able to compile, but the isolated thread always returns a "Response already sent." error message, instead of the response HTML I want to send. If not isolated, the procedure works correctly and returns the desired HTML page.
I have included other lines of code, not related to this issue, from the top of the unit, just to get you oriented:
...
private
procedure BlahBlah;
public
end;
// This is the procedure that is isolated
procedure ReportAllInvoices(ARequest: TBrookHTTPRequest; AResponse: TBrookHTTPResponse; AUserData: Pointer);
var
frmMain: TfrmMain;
implementation
...
procedure TfrmMain.brk_rtrRoutes38Request(ASender: TObject; ARoute: TBrookURLRoute; ARequest: TBrookHTTPRequest; AResponse: TBrookHTTPResponse);
begin
// Download All Invoices (Isolated)
ARequest.Isolate(@ReportAllInvoices);
end;
// -------- Isolators
procedure ReportAllInvoices(ARequest: TBrookHTTPRequest; AResponse: TBrookHTTPResponse; AUserData: Pointer);
begin
AResponse.Send('Hello', 'text/html; charset=utf-8', 200); //<-- The user sees "Response already sent" instead of "Hello"
end;
OS, compiler and Brook version to reproduce the problem, e.g.:
I'm building a Brook 5 Framework app, in which, some of the threads will be very slow to execute, so they need to be isolated. I am able to compile, but the isolated thread always returns a "Response already sent." error message, instead of the response HTML I want to send. If not isolated, the procedure works correctly and returns the desired HTML page.
I have included other lines of code, not related to this issue, from the top of the unit, just to get you oriented:
... private procedure BlahBlah; public end;
// This is the procedure that is isolated procedure ReportAllInvoices(ARequest: TBrookHTTPRequest; AResponse: TBrookHTTPResponse; AUserData: Pointer);
var frmMain: TfrmMain;
implementation ...
procedure TfrmMain.brk_rtrRoutes38Request(ASender: TObject; ARoute: TBrookURLRoute; ARequest: TBrookHTTPRequest; AResponse: TBrookHTTPResponse); begin // Download All Invoices (Isolated) ARequest.Isolate(@ReportAllInvoices); end;
// -------- Isolators
procedure ReportAllInvoices(ARequest: TBrookHTTPRequest; AResponse: TBrookHTTPResponse; AUserData: Pointer); begin AResponse.Send('Hello', 'text/html; charset=utf-8', 200); //<-- The user sees "Response already sent" instead of "Hello" end;
OS, compiler and Brook version to reproduce the problem, e.g.: