Joined: |
Jan 4, 2011 04:06 AM |
Last Post: |
Jan 29, 2011 12:45 AM |
Last Visit: |
Mar 20, 2011 02:32 AM |
Website: |
|
Location: |
|
Occupation: |
|
Interests: |
|
|
AIM: |
|
ICQ: |
|
MSN IM: |
|
Yahoo IM: |
|
|
Helg37 has contributed to 6 posts out of 21251 total posts
(0.03%) in 5,084 days (0.00 posts per day).
20 Most recent posts:
Hello ! Do not quite understand your question, but issues of implementation of Data Feed processing in my humble opinion is a question a specific developer. I showed an example, one way of handling a strong Data Feed. Details are already on the accurate implementation of the code by yourself. I do not claim purity of the sample code, but this scheme really works for me. But the code sample may be not optimal.
This is an example of logic that I use for processing Data Feed
using System.Threading; using System.Collections.Concurrent;
public ConcurrentQueue<Prints> prints; private EventWaitHandle wh_prints; Thread worker_print; static object locker = new object();
prints = new ConcurrentQueue<Prints>(); wh_prints = new AutoResetEvent(false);
worker_print = new Thread(WorkPrint); worker_print.Start();
Prints pq = null; GetPrint(pq); worker_print.Join(); wh_prints.Close(); worker_print.Abort();
public void GetPrint(Prints pq) { lock (locker) { prints.Enqueue(pq); wh_prints.Set(); } }
void WorkPrint() { while (true) { Prints pq = null; if (!prints.IsEmpty) { if (prints.TryDequeue(out pq)) { if (pq == null) { return; } } else continue; }
if (pq != null) { lock (locker) { ……………… } } else wh_prints.WaitOne(); } }
Hello ! I use queue of "supplier-consumer" ConcurrentQueue. In queue data is added, and another thread takes them and work.
please send me an example on С # for TCP / IP
thanks
Is there a similar restriction for the library NET for x64 for development on C# ?
|
|