p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   Throughput/Design Problem (http://p2p.wrox.com/showthread.php?t=59549)

tobriain June 28th, 2007 10:04 AM

Throughput/Design Problem

I hope one of you have found a solution to the following problem before. . . Thanks in advance if you have.

I have to implement an interface defined in an external program - I must have a method Notify() in my object

toimplement that interface. When there's an update, the Notify() method is called by the external program. I can

then collect any updates with a method call that returns a System.Array consisting of an ID (given by me when

implementing the connection), and a value.

The problem is that the array that I collect updates from is of fixed size (subsequent updates are not added to

the end of the array like a queue. . ), so sometimes by the time I've collected the update, set a member variable

in another object to the value (m_Object.SomeValue) and returned to respond to any subsequent Notify() calls, the

updates have been overwritten and I've missed some updates. . . Not great. I've removed any calculations I was

doing in these Set() methods, but it still doesn't return in time. .

This is a sample of my set-up:

ManualResetEvent m_NotifyEvent;
Thread m_UpdateThread;
. . . .
m_NotifyEVent = new ManualResetEvent(false);
m_UpdateTHread = new THread(new ThreadStart(RTDUpdates));
... . .. .

private void RTDUpdates()

    System.Array arrValues = m_RTDServer.RefreshData();
    if(arrValues > 0)
        for (int i =0; i<arrValues.GetLength(1); i++)
            int[] index1 = {0,i};
            int TopicID = Convert.ToInt32(arrValues.GetValue(index1));
                int[] index2 = { 1, i };
                        int TopicValue = Convert.ToInt32(arrValues.GetValue(index2));
                        switch (TopicID)
                            case 0:
                                m_Object.SomeValue = TopicValue;
                            case 1:
                                m_Object.ANotherValue = TopicValue;
. . . .

public void UpdateNotify()


How can I concentrate on maintaining the proper state of the variables i'm setting by collecting the updates and

immediately putting them into some kind of FIFO list.

Best regards,


All times are GMT -4. The time now is 02:37 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.