Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-05

Console application with multi-threading

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

Is it possible to have a multi-threaded console application? For example I have a console application that does logging to a file. The file logging is handled in a thread that does caching and contention handling. This works fine for GUI based applications, but what about Console based applications?

The reason I ask, is because I can't see CheckSynchronize() being called anywhere in TCustomApplication descendants like what Lazarus (console app project) creates?

So how does this work with TThread based threads and console apps?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Marco van de Voort
to Graeme Geldenhuys

In our previous episode, Graeme Geldenhuys said:

Show quoted text 6 lines
Is it possible to have a multi-threaded console application? For example I have a console application that does logging to a file. The file logging is handled in a thread that does caching and contention handling. This works fine for GUI based applications, but what about Console based applications?

It works fine also.

The reason I ask, is because I can't see CheckSynchronize() being called anywhere in TCustomApplication descendants like what Lazarus (console app project) creates?

Synchronization is an additional feature, not basic thread support. It can also be in a console app, but afaik then the application must be event driven (return regularly to some main loop). Like e.g. the textmode IDE (though it does not _USE_ threading)

In such mainloop checksynchronize should be called.

So how does this work with TThread based threads and console apps?

Reply by email

Vinzent Höfler
to Graeme Geldenhuys: Is it possible to have a multi-threaded console application? For example I have a…
Is it possible to have a multi-threaded console application?

Yes. BTDT.

The reason I ask, is because I can't see CheckSynchronize() being called anywhere in TCustomApplication descendants like what Lazarus (console app project) creates?

Well, if you want to do it that way, you're free to insert the call in your descendants, but...

So how does this work with TThread based threads and console apps?

... actually I never used CheckSynchronize at all. ;)

Vinzent.

Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01

Reply by email