Monday, July 21, 2008

TDM Rerun #10: Synchronisation Toolkit Revisited

The plan for this article was to present an implementation of a shared memory pool: a mechanism that allows multiple data producers to send data to one data manipulator. In fact, I already had all the code and half the article completed when I found out that my solution doesn't always work. Everything was OK when both ends of the pool (producer and manipulator) were implemented in the same application or in two 'normal' applications. But if I tried to change one of those apps into an NT service, the shared pool stopped working.

- Synchronisation Toolkit Revisited, The Delphi Magazine 91, March 2003

My 10th TDM article returned to my pet theme - synchronisation and communication. First part described some aspects of the NT security model and second implemented shared memory-based queue, capable of transporting messages from a GUI application to a service and back.

It looks like I'll have to return to that topic again - I got some reports recently that my approach doesn't (always?) work on Vista :(

Links: article (PDF, 54KB), source code (ZIP, 2.2 MB), current GpSync unit

5 comments:

  1. "It looks like I'll have to return to that topic again - I got some reports recently that my approach doesn't (always?) work on Vista :("

    No it doesn't work in Vista at all in my tests.

    ReplyDelete
  2. Anonymous09:58

    Well,

    i fixed it like this :

    in TGpToken.Create(withPrefix: string) change the line

    gtTokenName := withPrefix + Copy(gtTokenName, 2, Length(gtTokenName)-2);

    with

    gtTokenName := 'Global\' + withPrefix + Copy(gtTokenName, 2, Length(gtTokenName)-2);

    Now if you add 'Global\' to your Namespaces strings, the code is working ....

    ReplyDelete
  3. Thanks for the info! I'll incorporate it into the codebase.

    ReplyDelete
  4. Anonymous21:34

    The 'Global\' prefix will work in Vista but will not in XP without Terminal Services installed ...

    Please read this http://msdn.microsoft.com/en-us/library/aa382954(VS.85).aspx, reg. Kernel Object Namespaces before you make any changes ....

    ReplyDelete
  5. Thanks. Will do. In all cases, I didn't intend to force 'Global\' prefix on all OSes. I know what is the function of 'Global\' and 'Local\'.

    ReplyDelete