Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi programmers,
in my program i have a compute out of my program. i mean my program in meddle of codes, send a data to another program (which written by me) for computing and then it receive the computed data. (my connection between this two program is like Pipe C# Async Named Pipes[^])

after sending data for compute i need a delay for doing next line of codes until computed data come back.
my codes:

C#
...
      _pipeClient = new PipeClient();
      _pipeClient.Send(Cloud_Intelligent_Output, "TestPipe", 1000);
      _ctr++;
      ( some code for waiting until result back )

... (Some other codes which i want stop running until result return back)


Please don't Timer and excuse from my awful Asking. :)
Posted
Comments
Sergey Alexandrovich Kryukov 28-Jul-13 14:35pm    
Is the task a separate thread of the same process, or a separate process?
—SA
[no name] 28-Jul-13 14:37pm    
a separate process
Fredrik Bornander 29-Jul-13 2:49am    
How is the computed result returned to the calling process?
Foothill 29-Jul-13 17:39pm    
You can always use a Delegate method for a callback.

Have you tried option of async and await feature of C# 5.0 and .Net 4.5?
This is link has example of how to do it

Asynchronous Programming in C# 5.0 using async and await


For more details you can refer to book
•C# 5.0 in a nutshell: Joseph Albahari (Author), Ben Albahari (Author)

Let me know if this helps you....
 
Share this answer
 
If you don't want to use .NET 4.5 (and therefore, Visual Studio 2012), you can use the AutoResetEvent [^]feature.

Here is an example more specific to what you need.[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900