So, the profiler is written in c++ and is launched by the CLR automatically when the process to be profiled is launched. The process then launches another application (the main target of profiling). Profiler is launched for this process also. All this is taken care of, but the problem is: Only one of these two profilers can communicate with the front end application via NamedPipe. I need both the profilers to write on the same pipe so that the front end application remains straight-forward and simple. Is this possible using some kind of semaphore to ensure that one of the processes write to the pipe at one time? I use the CreateFile() function to open the pipe in the profiler.
Asked
Active
Viewed 70 times
1
-
You don't need any synchronization when you use a pipe in message mode. Do keep the profiler simple first, it is the one that has the largest impact. Two pipes ought to simplify things quite a bit, you don't have to tell the front-end where the info came from. – Hans Passant Sep 28 '17 at 08:07
-
it seems that only the first process is able to open the pipe. The other process fails to connect to pipe and the CreateFile() method sets the LastError to something other than ERROR_PIPE_BUSY @HansPassant – Ali tariq Sep 28 '17 at 09:35
-
Should I use the CallNamedPipe() function instead?? – Ali tariq Sep 28 '17 at 10:24