risoflora / brookframework

Microframework which helps to develop web Pascal applications.
https://risoflora.github.io/brookframework
GNU Lesser General Public License v2.1
233 stars 54 forks source link

Isolated thread is unable to .Send FreePascal only #30

Closed KevinLeeMorris closed 3 years ago

KevinLeeMorris commented 3 years ago

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.:

silvioprog commented 3 years ago

It seems this feature is working only in Delphi. Will be fixed ASAP ...