Icon View Thread

The following is the text of the current message along with any replies.
Messages 31 to 32 of 32 total
Thread Writing a function that queries data in Thread
Fri, May 23 2014 5:22 AMPermanent Link

Matthew Jones

Roy Lambert wrote:

>  remember to never access the stringlist in the main thread until the
> providing thread has finished

That is where the "data ready" flag comes in...

Threads is all about discipline. One thing at a time to read or write
any data. With string lists in complex code, I typically have a
critical section that controls access. If something wants to read the
list, I enter the critical section, copy the list to their local list,
and release. They can then work on their local copy as long as they
need without slowing the writer.

--

Matthew Jones
Thu, May 29 2014 9:51 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Raul

>Note that you can send as many messages to main thread as you want.
>Depending on amount of data and other things it might be easier to just
>post the data as it becomes available to main thread and maintain the
>stringlist there.

I like that, then the user could decide to say "sod it" and just move on without waiting.

>You're actually using pointers all the time.
>
>There is no real difference between "SomeObject.Create() /
>SomeObject.Free()" and "New(rec) / Dispose (rec)".
>
>Both are pointers - one just happens to point to instance of dynamically
>created class and other to record. If you prefer classes then you can
>just create your own and pass that around and just remember to create in
>worker thread and free in main thread.

I have to disagree. I had a major argument with a TeamB about this issue. My personal belief is that no application programmer should ever have to deal directly with pointers. They are just to dangerous. I accept that "under the hood" there's a lot of pointer manipulation going on but the whole point of a decent language should be to abstract that and make it a lot safer.

Roy Lambert
« Previous PagePage 4 of 4
Jump to Page:  1 2 3 4
Image