` Threading - 1 (Andy Ireland) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Clarion 6: Threading - 1
2002-12-15 -- Andy Ireland
 
Newsgroups: softvelocity.products.c55ee > That leaves a question for the gurus: How do you maintain similar > static global data integrity in the new model as was done > (automatically) in the old model? Let's say I have Glo:SomeVariable > of type Long, non-threaded, that I have been using to pass information > between the main window and another procedure that can be started > multiple times on separate threads? Pass it as a parameter or use synchronisation. Here's the bottom line.... Global data that is read / write / shared is not safe Global data that is read only is safe Global data that is threaded ',THREAD' is safe But also consider the affects of changes.... Changing Global read / write / shared to ',THREAD' breaks the app logic as it is no longer shared and not inited on each thread which means the change to the app is to either sync the code or redesign how these vars are used and the code that uses them. Therefore it is not in most cases safe to just make them threaded in 6.0 as this breaks the application logic. The answer is to roll out globals completely in favour of vars that are passed around and all objects cooperate. The next problem comes in the form of deadlocks and all the pitfulls that should be understood in order to avoid it etc but that is not something that can be taught on the NG's. Deadlock is where all threads are blocked waiting on another and none are running. This can be caused by DLL init code blocking on an event as this grabs the process mutex as do other things or entering a critical section that has already been entered etc so it's not going to be all plain sailing for people. IMO the pre-emptive threading issue has been far over simplified so as not to appear daunting but these are issues people will hit sometime or other now that they are expected to use threading and synchronisation functionality from the API. Regards Andy Plugware Solutions.com Ltd, taking the puzzle out of I.T Tel : +44 1249 813335 Fax : +44 1249 813462


Today is April 27, 2024, 11:58 am
This article has been viewed 35117 times.
Google search has resulted in 9 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: