• Advertisement

Archived

This topic is now archived and is closed to further replies.

Multithread, qe?

This topic is 6763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
I think it overlaps

(oh yeah, I'm not from Sydney, I'm from Chch NZ)

------------------
-------------------
LoungePig
OpenGUI

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Multithreading means that one thread started with CreateThread(?), is executed once. This registered function is running 'parllel' to all other threads. This means you have to start many threads to get multiple instances of the function.
Each function is executed in another stack frame. With only one processor, this means that the first thread is started sometime, when Windows decides to switch to another thread, Windows saves the stack of the first thread, and copies the saved stack from the second thread onto the stack. This is called Context switching.
The above explains that a function exists this way multiple times in memory.

Hope you're not too confused.
A source to get information on this topic is the Documentation of the WinSDK (e.g. VC++).

Look there for information on CreateThread, Events, etc.

Share this post


Link to post
Share on other sites
you should use a critical section to prevent the same thing happening at the same time, else if the function is executing and doesn't finish by the next timer call, two concurrent copies of the function will be executing with both of them accessing the backbuffer, which can be nasty

------------------
http://members.xoom.com/mutex0

Share this post


Link to post
Share on other sites
Im only new in the Windows development environment, so I dont know about multithreading etc..
Whats the deal, how do you control the multithreading?
And do the multithreaded functions repeat over themselves if the function is too slow to quit before the next instance of the same function excecutes, or does it wait until the function is finished or skip that instance?

For example, say you had an UpdateSurface() function that is called every 100ms by a mmtimer, but the function takes longer than the 100ms to exit. Does the next instance (100ms later) skip, overlap, or wait?
Im guessing the overlapped code uses seperate memory allocations to avoid miscalculations...right?

PS. Anyone else from Sydney AUS?

-:->= SikCiv =<-;-

Share this post


Link to post
Share on other sites

  • Advertisement