Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Clarion 6: Threading - 2 2002-12-15 -- Andy Ireland Newsgroups: softvelocity.products.c55ee
Hi Arnor,
> Thanks for the clarification. But how would you pass variables around
> between procedures on different threads? Say you have a window on
> thread 2 and another window on thread 3 and they need to be accessing
> the same data, how would that best be done? I've thought that you
> could perhaps use a non-threaded class that has these vars as
> properties and then use methods to update/retrieve the data, but
> wouldn't that have the same non-safe status as global variables? I.e.
> couldn't two threads be trying to update the same class prop at the
> same time?
This is a flaw in clarion. A thread when created takes a long not a string.
It should have been a long and not a string and I hope it has changed. You
could however pass the address of something in the string. You should
actually keep each thread distinct for the most part but you could always
hand off using synchronisation. Why would threaded windows need to access
the same data? Why not one threaded window and the others called from it
SDI? If we're talking about application configuration data, then this can be
global and read only. If a thread needs to change it, sync the change and
send an app messate informing other threads it has changed. It would not
have the same status if wrapped using something like a reader / writer lock
or a spinlock again things that have not been discussed. This threading
change has been greatly oversimplified by nearly everyone.
The simplest change is to put a critical section around the methods but this
will just cause your app to block across all accessing threads which is not
always ideal. Most MDI apps do not share data across threads, unless it is
mutexed or is read only. However because people have been used to doing this
for a long time, I think this will actually cause more problems for clarion
programmers than had the change happened when Win95 came out.
People will need to do some learning.
Regards
Andy
Plugware Solutions.com Ltd, taking the puzzle out of I.T
Tel : +44 1249 813335
Fax : +44 1249 813462
Today is November 23, 2024, 3:27 am This article has been viewed 35319 times. Google search has resulted in 7 hits on this article since January 25, 2004.
|
|