Recent

Author Topic: fpweb/fcl-web: TCustomHTTPApplication and TThread.Queue/Synchronize  (Read 4003 times)

SirTwist

  • New Member
  • *
  • Posts: 21
Good Evening, dear fellows,

I am just trying my first steps with fpWeb and the standalone http server.
In addition to the standard framework I added a data module which I instantiated within the main application:
Code: Pascal  [Select][+][-]
  1. begin
  2.   Application.Title:='webserver';
  3.   Application.CreateForm(TdmMain, dmMain);
  4.   Application.Port:=4040;
  5.   Application.LegacyRouting := False;
  6.   Application.Threaded:=True;
  7.   Application.Initialize;
  8.   Application.Run;
  9. end.

The web application itself is multithreaded, and so I want to synchronize some activities with the main thread. In "normal" (GUI) applications I call therefor TThread.Queue(@do_something) and everything works fine. In TCustomHTTPApplication, nothing will happen, and with a TThread.Synchronize the program will hang completly.

Has anyone a clue what is missing or what I am doing wrong here?

Kind regards,
Sir Twist

Warfley

  • Hero Member
  • *****
  • Posts: 814
Re: fpweb/fcl-web: TCustomHTTPApplication and TThread.Queue/Synchronize
« Reply #1 on: November 30, 2021, 03:09:12 pm »
It seems that the FCL Web Applications don't check the message queue on the mainthread.
It also doesn't make sense, because the main thread should server the clients as fast as possible.

If you want to synchronize your threads, you need to do that yourself in a custom thread

 

TinyPortal © 2005-2018