Given (my) uncertainty about what happens when you mix MMF/threads/ties et al, I'd offer two alternative approaches:
You still have the problem of arranging for different processes to write to different areas of that shared memory without collisions, along with synchronisation between processes.
This way, you remove the in-process contention and the uncertainty of behaviour surrounding having multiple tied interfaces on separate ithreads attempting to juggle access to a single process global resource.
Each thread can create it's own connection to the external program which avoids adding complexity to the process you are trying to debug. You dodge all the problems associated with synchronisation and conflicts that arise by trying to share global resources between threads through tied interface. It would probably be a lot faster to boot.
I'd use a queue in the server to coalesce the inputs from the clients into a coherent, ordered whole for saving or presentation.
I'd go for the latter approach, as I think that debug tools should impose as little complexity and overhead as possible upon the programs thet are debugging, and to my mind, opening and writing to a socket fits that bill quite well.
Trying to manage allocations of memory and synchronise access to them from multiple threads in multiple (unknown) processes; without creating deadlocks; and without your sync'ing and locking interfering with their own sync'ing and locking--given that you don't know what they might be doing, and indeed you are likely to be trying to help them debug it--just seems like too big a hill to climb.
Synchronisation of access to memory is the Achilles Heel of threads, and the best way of dealing with it is to avoid doing it whenever possible.
Beyond that, all I can do is wish you the very best of luck :)
In reply to Re^3: Win32::MMF + threads misbehavior
by BrowserUk
in thread Win32::MMF + threads misbehavior
by renodino
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |