home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.protocols.tcp-ip      TCP and IP network protocols.      14,669 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 12,738 of 14,669   
   Skybuck Flying to All   
   Re: UDP Speed Test Version 2.93 Now Avai   
   22 Feb 09 04:47:18   
   
   XPost: alt.comp.lang.borland-delphi, alt.winsock.programming   
   From: BloodyShame@hotmail.com   
      
   Maybe it could even be more simple without the branch... but then I don't   
   know if it would be faster.   
      
   For example the "worker/producer" threads could do:   
      
   mOwnCriticalSection.Enter;   
   mOwnCriticalSection.Leave;   
      
   if TryLock then   
   begin   
       // copy to shared data.   
      
       TryUnlock;   
   end;   
      
   // otherwise proceed doing more work.   
      
      
   Now a gui thread/consumer that wants to display a consistent view of some   
   data could then simply lock all the threads/workers/produces by doing so:   
      
   mProducer1.mOwnCriticalSection.Enter;   
   mProducer2.mOwnCriticalSection.Enter;   
   mProducer3.mOwnCriticalSection.Enter;   
      
   // access data of producer1,2,3 to display in gui.   
      
   mProducer3.mOwnCriticalSection.Leave;   
   mProducer2.mOwnCriticalSection.Leave;   
   mProducer1.mOwnCriticalSection.Leave;   
      
   This technique should lock out the producers from their own "producing code"   
   when the gui needs to access their data in a consistent/synchronized way.   
      
   At the same time this should allow the producers to run real fast when they   
   are not locked out... since they will simply enter and leave their own   
   critical section real fast... and will then simply try a "try lock" on any   
   data that needs to be shared for example between other producers...   
      
   Again just another idea/concept might be usefull, might be not ;)   
      
   Bye,   
     Skybuck.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca