Synapse Http Server lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- fjabouley · 2020-06-04 12:56 Hello all, I'm trying to port my former http server using synapse libraries, just to see which one is the more stable. May I have your opinion on what I coded if I'm doing totally wrong, or if it is OK ? It has currently worked for many days without issues, but I don't know if there is a better way coding it... Best regards ---------------------------------------------------------------------- yus · 2020-06-04 18:25 Synapse have examples with HTTP and HTTPS server. I using synapse http server, work perfect. I have a question about using the critical section? I think to use correctly Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i locksection.Entertry  /// some critical codefinally  locksection.Leaveend And i use TRTLCriticalSection https://www.freepascal.org/docs- html/rtl/system/trtlcriticalsection.html You code will be Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  locksection: TRTLCriticalSection; TSomeClass.Create;begin ///  some co de InitCriticalSection(locksection);end; TSomeClass.Destroy;begin ///  some code DoneCriticalSection(locksection);end; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i EnterCriticalsection(locksection);try  /// some critical codefinally  LeaveCriticalsection(locksection);end ---------------------------------------------------------------------- fjabouley · 2020-06-05 05:52 Thanks for you reply. Actually I used critical section in the thread's procedures, mainly while loading files from hard drive (don't know if it is useful, but I thought that 2 threads reading the same file at the same time would be an issue) and to update/read the sessions which are stored in a global variable, outside the main thread. But there must be another way to do that (or not ?) Regards