[DUG] Best way to make this thread safe

Maurice Butler likemagic at quicksilver.net.nz
Fri May 18 20:45:45 NZST 2007


Further to this  Mastering Delphi 4 by Marco Cantu http://www.marcocantu.com
(table of contents follows)

Note in d3/d4 the tthread object was flawed I have not checked to see if it
has been fixed in later versions. 

Exception handling in threads is critical an unhandled exception on:
creating a thread,
in the thread or 
disposal of the thread,

can cause the complete melt down of your application and occasionally
windows 2k.

Maurice



CHAPTER 20: MUTEXES, THREADS, AND SYNCHRONIZATION
    Checking for a Previous Instance
      of an Application
      Traditional Techniques
        Looking for a Copy of the Main Window
        Activating the Previous Main Form
        Handling User-Defined Window Messages
        Searching the Window List
      Using a Mutex
    Events, Messages, and Multitasking in Windows
      Event-Driven Programming
      Windows Message Delivery
    Idle Computing and Multitasking
      Background Processing
    Multithreading in Delphi
      The TThread Class
      A First Example
      A Locking Example
      Synchronization Alternatives
      Thread Priorities
      A Database Example
    Synchronizing Threads
      Waiting for a Thread
      Windows Synchronization Techniques
        Building an Example
        The Plain Thread
        Using Critical Sections
        Using a Mutex
        Using a TCriticalSection VCL Object

-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Maurice Butler
Sent: Friday, 18 May 2007 5:13 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Best way to make this thread safe


1. does not use vcl
2. access to file is serialized so only one thread at the time can access it
3. proven in real time manufacturing enviornment for over 10 years
4. if you don't understand why it is thread safe you shouldn't be using
threads

-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Trevor Jones
Sent: Thursday, 17 May 2007 11:16 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Best way to make this thread safe


In what way is this thread safe?


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe




More information about the Delphi mailing list