Recent

Author Topic: Error during build application  (Read 1051 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Error during build application
« on: February 27, 2020, 10:48:03 am »
Hi guys, I have a problem with an http web server application written in lazarus. I can't fill in. Tells me:

unit1.pas(41,6) Error: Identifier not found "Synchronize"

Basically I want to write some messages in a single place in memory (through a multithreaded program) without having to rely on a database. Who can help me? I attach an example reproducing the error. Thanks so much
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Error during build application
« Reply #1 on: February 27, 2020, 12:47:25 pm »
IIRC, Synchronize is a method of TThread, not an independent function, so you can't call it like that.

In your case (and from a very quick look to your code) what I would do probably is to use the critical section (or other "locking" mechanism) inside AddMessage, which is where it's needed.

I would need to study the code deeper to give more meaningful (and complete) advice but I don't have time now, sorry. :(

Anyway, HTH
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Error during build application
« Reply #2 on: February 27, 2020, 01:50:23 pm »
Like this attachment?!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Error during build application
« Reply #3 on: February 27, 2020, 06:20:28 pm »
Yeah, something like that :)

Though note that critical sections don't protect against re-entry within the same thread so maybe you should use messages or better, RTLEvents; depends on how TFPWebModule (of which I know very little) is implemented.

Try with that and see how it behaves with a heavy loads (i.e. lots of simultaneous requests).
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Error during build application
« Reply #4 on: February 27, 2020, 10:20:49 pm »
I do not know how to do? Can you give me some examples?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018