Delphi ... the higher, the better!
All Windows platforms
&
Register Now |
€75
thinking... |
|
Under construction |
Threads: Multithreaded
Application Model.
I downloaded many multithreaded applications from various
sites. None of them was reliable as I wished. I read lots of stuff about
race conditions, deadlocks, how can threads corrupt data
or starve. And practically all gurus out there are saying more or
less along the lines of 'it is dangerous', 'don't you dare do it', 'use
with caution', 'use my stuff'. I didn't find an entire application (source code) which
will implement good protection and threads synchronization, database access,
etc. This is a project that started back in the year 2000.
What I tried to accomplish in this application is to
create a
model, which than can be used to start many other multithreaded apps. If you
need badly to see some multithreaded code, Threads
is for you. If you are in a hurry to deliver a multithread application,
here you go; get Threads and I believe
in shortest time you will come up with your problem solved. How can you
use this stuff? In two ways:
learning and/or adding your own code to it. What the sources will give
you:
-
threaded database access, using FireDAC (with
MSSQL and Firebird), DBISAM, ElevateDB
-
threaded Indy sending/receiving email, ftp
downloading or uploading;
-
threaded
Indy or WMI pings (you can setup a list of
web servers you want to ping);
-
threaded dynamic reports using ReportBuilder
or
FastReport;
-
a lot (and I mean a lot) of
thread management: threads waiting for other threads to process
things, threads sharing resources, threads running standalone
forcing other threads to quit or blocking other threads from
running; multiprocessor thread distribution;
-
threaded folder changes monitor;
-
threaded PDF file conversion. Currently, Threads can convert Word, Excel and Postscript files to PDF. It
uses Ghostscript for that matter; conversion requests can arrive via
file copy, email monitoring, or directly through database records.
Customers have a table and conversion can happen based on some plan.
This feature is implemented currently with MSSQL database;
-
threaded
WMI events monitoring (in-the-box Win32__PingStatus, or, you can setup anything else at
run-time from whatever namespace);
-
threaded
XML processing using own XML parser (no external DLL);
-
REST
server. Since REST requests are anyway threaded by the Vcl, I
chose not to have UI for it. However it is fully functional, the
Client app makes true REST requests and Threads processes the
requests using threaded database access (MSSQL)
-
threaded
launching secondary apps or batches and monitor them closely,
terminate them on a timer, etc;
-
core internal wrapper classes that can do the
email stuff;
-
core internal sources for processing strings
(yeah, we do have SysUtils, StrUtils, but there is still stuff that
you can’t find there);
-
core internal sources for directly using WinInet
library;
-
core internal sources for using WBEM (WMI stuff
made easy);
-
core stuff
to monitor application threads, memory, cpu usage, handles and other
things;
-
threads
can now work in various modes: normal (execute something and
exit), loop (repeatedly execute something until application
terminates), pulse (wait for some external signal(s) to
execute something until application terminates) or worker
(repeatedly wait until a new work item is passed and execute it, as
long as it didn't expire or application terminated) - see the last
column in Threads screenshot;
-
message
processing in secondary threads;
-
just for
fun I added a few StarShip threads: HAL (a
controller) and various slaves (Life Support, Shields, Engine,
Weapons, Bridge, etc). They all use power when working and can be
refueled by the controller. The starship can travel using various
warp speeds and its weapons system is fully loaded with torpedoes
and phasers; the progress bar for these threads indicates power left
in the banks, nicely drawn in a 3-color gradient;
-
stuff
that I probably forgot about...
Threads
is getting upgdated to use runtime packages. So, the worker
threads have been grouped in some external packages which then can be
loaded and unloaded at runtime with a simple click on a checkbox or,
automatically from an updater thread worker. In other words, Threads
can now update its modules while is running!
Click here to
view image (gif 256KB), or check the version history
here (jpg 140KB).
Or even better: take a look at my other applications, based
entirely on my own threading engine. Take a look at
EZ News Reader (jpg 138KB - however, since I'm not in the business of
writing a news reader, this project is dead. There are too many newsreaders
out there already). Or the Printer Usage Monitor
application.
Mike Lischke's VirtualTrees are heavily used in this application. Mike's
old web site is
here.
Have fun !
|
Built projects:
The application:
setup (4 MB) 2015.12.27. The demo is 64 bits and compiled with Delphi 12.1 - under
construction.
( p.s. I like
Martin Harvey's thread tutorial. )
|