Thursday, May 01, 2008

TDM Rerun #8: A Synchronisation Toolkit

Every programmer accumulates reusable code over the years and I am no exception. Sometimes, parts of that code seem generic enough to be worth documenting and presenting it to the public.

Today, I'd like to put on display four classes belonging to the inter-process synchronisation part of my personal toolbox.

- A Synchronisation Toolkit, The Delphi Magazine 86, October 2002

In October 2002 I presented my GpSync unit, which is still very actively updated and developed. At the time of writing, there were four reusable classes in this unit - a token, a group, a counted group and single-write-multiple-readers reimplementation copied (and translated from C to Delphi) from Advanced Windows by Jeffrey Richter.

Since that first public occurrence, GpSync was extended with a flag, a counter, a message queue (shared-memory based, can be used to send messages from an interactive application to a service and back), and a circular buffer. To this day, it represents most common building blocks I'm using in multithreaded applications.

 

Links: article (PDF, 148 KB), source code (ZIP, 196 KB), current GpSync unit

5 comments:

  1. Hi, tryng to compile in Delphi XE8, but get error:
    [dcc32 Error] JclSysUtils.pas(2940): E2010 Incompatible types: 'TJclWaitResult' and 'TWaitResult'

    Seems that your units depend on Jedi package; can you point a version which compile with XE8 ?

    Regards,
    Marco

    ReplyDelete
    Replies
    1. This looks like you are using JclSysUtils that is not compatible with XE8. Get a fresh one.

      Delete
    2. Thank you, I have donloaded the latest GpUnits, but now in
      unit GpSharedTable I miss uses of GpString.pas
      Can tell me where find it ?

      Delete
    3. GpString is now part of GpDelphiUnits.

      Delete
  2. Latest GpSync is available on GitHub, https://github.com/gabr42/GpDelphiUnits.

    ReplyDelete