[Lazarus] fpWeb and server-sent events

Sven Barth pascaldragon at googlemail.com
Thu Jun 4 17:07:49 CEST 2020


Luca Olivetti via lazarus <lazarus at lists.lazarus-ide.org> schrieb am Do.,
4. Juni 2020, 15:51:

> El 4/6/20 a les 15:37, Michael Van Canneyt via lazarus ha escrit:
> >
> >
> > On Thu, 4 Jun 2020, Luca Olivetti via lazarus wrote:
> >
> >>>      FServer.Port:=8080;
> >>>      FServer.Threaded:=true;
> >>>      FServer.Run;
> >>>    except
> >>>      on E:Exception do
> >>>      begin
> >>>        writeln(E.Message);
> >>>        sleep(1000);
> >>>        FServer.Free;
> >>>      end;
> >>>    end;
> >>
> >> Oh, and I had to do some more overriding so that the response could
> >> have a reference to the calling thread (needed if I want to use
> >> synchronize).
> >
> > That seems a bit strange, since you can do synchronize without needing
> > access to the thread object using a class method of TThread ?
>
> TThread.Synchronize needs a TThread as the first parameter.
> This is my work in progress
>

The thread parameter can be Nil. TThread will then use the CurrentThread
threadvar and failing that it can also work without any thread object.

In fact it is safer not to pass a thread.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200604/c19b0412/attachment-0001.html>


More information about the lazarus mailing list