SEVI Posted June 28, 2003 Posted June 28, 2003 (edited) Help threads!! Please help!! I want to spawn multiple threads which will call a third party bitmap transition method. Basically enabling an image in a picture box to switch from one to another with a choice of transitions in between. Easy enough for a thread to do this sequencially. ie PictureBox1 5 second transition begins 1 sec .. 5 secs PictureBox1 5 second transition ends then PictureBox2 5 second transition begins 1 sec .. 5 secs PictureBox2 5 second transition ends The problem is that I would like to be able to perform 2 or more transitions at once. After querying support for the product, the advice to "research threading" was given.. thanks alot!! My question is how can concurrent threading be implemented when the thread itself is a method that takes a length of time. How can a thread containing an external method be told to stop executing before it has completed it's task, while another thread calling the same method catches up with it? Then resume the first thread where it was stopped. ie PictureBox1 5 second transition begins 1 sec.. then PictureBox2 5 second transition begins 1 sec.. PictureBox1 5 second transition continues 2 sec.. then PictureBox2 5 second transition continues 2 sec.. .. .. PictureBox1 5 second transition ends PictureBox2 5 second transition ends Been pulling my hair out reading up on Threads and Threadpools. Syncronisation sounded like what I needed, but after researching it seems that prevents multiple threads accessing data at the same time. If this makes no sence I'll expand where it's unclear. Any advise, suggestions, references or samples would be much apprecitated!! Thanks Edited June 28, 2003 by SEVI Quote
*Experts* Volte Posted June 28, 2003 *Experts* Posted June 28, 2003 I doubt what you're talking about it directly possible... You can easily start two more threads and have both of the actions happening at once, but having an action stop in the middle of execution will not be possible I think. You can use Thread.Suspend() to suspend execution of your thread, but only once it gets to a safe-point. That means it won't stop in the middle of doing something, it will stop once it gets finished and not continue untill to start it again. You might look into using the SyncLock keyword in VB, however, as it prevents two threads running the same thread procedure from executing the same bit of code at the same time. Quote
Nate Bross Posted April 7, 2005 Posted April 7, 2005 Here is a good site, this article is pretty simple gives the basic idea of threading. http://www.zone13.net/zone13/default.asp?PageAction=TECHTALK&TechID=539 Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Mister E Posted April 7, 2005 Posted April 7, 2005 You can suspend a thread that is not in its critical section. Suspending a thread that is its critical section would cause either dead lock or starvation, depending on the circumstances. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.