Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 28th, 2007, 10:04 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Throughput/Design Problem

Hello,

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));
m_UpdateThread.Start();
... . .. .

private void RTDUpdates()
{
    m_NotifyEVent.WaitONe();

    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;
                                break;
                            case 1:
                                m_Object.ANotherValue = TopicValue;
                                break;
                        }
                }
        m_NotifyEvent.Reset();
}
. . . .

public void UpdateNotify()
{

    m_NotifyEvent.Set();
}

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,

Tom.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Design Question/Problem dparsons ASP.NET 1.0 and 1.1 Professional 0 November 20th, 2006 12:56 PM
Design Schemes Install Problem obadiah BOOK: Expert One-on-One Access Application Development 1 October 4th, 2006 03:14 PM
Object Design Pattern problem aldwinenriquez .NET Framework 2.0 2 September 7th, 2006 04:10 AM
IE web control design problem zouky VS.NET 2002/2003 1 September 26th, 2004 07:31 PM
Java Design issue with UML and Design Patterns the_logical_way Apache Tomcat 0 May 31st, 2004 04:02 AM



All times are GMT -4. The time now is 12:21 AM.


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