Re: Multi Threading Options



My problem is that I want to run a pretty hefty drawing routine on the other
thread - I really want to cause thread 2 to wait for data to finish being
written before it starts drawing the next image, and cause thread 2 to tell
thread one it can update again once it has finished drawing.

My problem is I recieve live events from a server, these events update
records in a linked list, and sometimes trigger a response from one of the
entries in the linked list which may include another loop, for example... if
I recieve a 'chat' type of message that relates to one of my linked list
values, i may need to itterate through each one - sending a message back to
them, which may change values within them.

At the same time I want another dialog to be running a map of them (they are
avatars represented in 3d space, their positions, attributes etc). However,
the SDK that I use from Active Worlds will soon be multithreaded itself, and
it is important that I find a way to make my shared global variables safe...
otherwise im a tad screwed basically!

--
- Mark Randall
http://zetech.swehli.com

"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:ma9q91tdh86lav3q38c7v67p2eed44n7gg@xxxxxxxxxx
> There is no multiple-reader-single-writer synchronization primitive at
> user level.
>
> If you have circular lists, and you lock them from two different threads,
> you are almost
> certainly a candidate for deadlock.
>
> Generally, most people seem to ignore the MFC locking primitives because
> of the bizarre
> implementations. Go for the raw synchronization primitives.
>
> The multiple-reader-single-writer problem can be solved in a fairly clumsy
> way, by opening
> a file in read+write mode, and using a file lock. File locks allow
> multiple readers and
> single writers. But they don't solve the deadlock problem, unless you
> apply the lock to
> the entire structure. And I have no idea of the overhead involved in this
> technique; it
> might swamp the nominal gain of having multiple readers run concurrently.
> joe


.


Loading