Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Thread.Sleep locks my movies. Why?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-31-2006   #1 (permalink)
Philippe Lavoie
Guest


 

Thread.Sleep locks my movies. Why?

Hi

To fake a slow connection, I do Thread.Sleep(random_delay);
However when I do that, it stops the movies on the screen (actually a
single movie). It also stops my story boards.

That Thread.Sleep is a delegate function called through the following

Application app = Application.Current;

app.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background,
new GetProductList(this.PopulateProductListHandler));

Anyways, I can fix this behavior?

Thanks

Phil

My System SpecsSystem Spec
Old 04-04-2006   #2 (permalink)
Nick Kramer [MSFT]
Guest


 

Re: Thread.Sleep locks my movies. Why?

Animations & storyboards, along with input processing, layout, data binding,
and a few other things, happen on the UI thread, so if the UI thread is
sleeping, those things won't get done.
https://blogs.msdn.com/nickkramer/ar...17/553378.aspx has more
details on WPF threading.

Why it's pausing the video is well is a little more of a mystery to me --
once the movie is started, the rendering happens on a different thread (the
render thread). All I can figure is maybe at some point, the movie needs to
synchronize the clock with the storyboard, and at that point gets stuck
waiting for the UI thread.

-Nick Kramer [MSFT]

---
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message
news:uTDZw$QVGHA.6084@TK2MSFTNGP14.phx.gbl...
> Hi
>
> To fake a slow connection, I do Thread.Sleep(random_delay);
> However when I do that, it stops the movies on the screen (actually a
> single movie). It also stops my story boards.
>
> That Thread.Sleep is a delegate function called through the following
>
> Application app = Application.Current;
>
> app.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background,
> new GetProductList(this.PopulateProductListHandler));
>
> Anyways, I can fix this behavior?
>
> Thanks
>
> Phil



My System SpecsSystem Spec
Old 04-04-2006   #3 (permalink)
Philippe Lavoie
Guest


 

Re: Thread.Sleep locks my movies. Why?

My issue is to get background processing done that will eventually
update some of the databinds, i.e. the UI thread (I guess).

Scenario: I do a request to a web service to fetch some products. I
don't want to block the UI, but the UI needs to be aware that the data
representing the products has been updated.

My approach seem to work except if I do a sleep. Perhaps I'll just add a
sleep on the web service itself to do my tests

Thanks

Phil

PS I'll start reading your whitepaper ASAP.

Nick Kramer [MSFT] wrote:
> Animations & storyboards, along with input processing, layout, data binding,
> and a few other things, happen on the UI thread, so if the UI thread is
> sleeping, those things won't get done.
> https://blogs.msdn.com/nickkramer/ar...17/553378.aspx has more
> details on WPF threading.
>
> Why it's pausing the video is well is a little more of a mystery to me --
> once the movie is started, the rendering happens on a different thread (the
> render thread). All I can figure is maybe at some point, the movie needs to
> synchronize the clock with the storyboard, and at that point gets stuck
> waiting for the UI thread.
>
> -Nick Kramer [MSFT]
>
> ---
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
>
> "Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message
> news:uTDZw$QVGHA.6084@TK2MSFTNGP14.phx.gbl...
>
>>Hi
>>
>>To fake a slow connection, I do Thread.Sleep(random_delay);
>>However when I do that, it stops the movies on the screen (actually a
>>single movie). It also stops my story boards.
>>
>>That Thread.Sleep is a delegate function called through the following
>>
>>Application app = Application.Current;
>>
>>app.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background,
>> new GetProductList(this.PopulateProductListHandler));
>>
>>Anyways, I can fix this behavior?
>>
>>Thanks
>>
>>Phil

>
>
>

My System SpecsSystem Spec
Old 04-05-2006   #4 (permalink)
Nick Kramer [MSFT]
Guest


 

Re: Thread.Sleep locks my movies. Why?

Yeah, a server-side pause would do a really good job of simulating what
would actually happen in the case of network lag.

--
-Nick Kramer [MSFT]

---
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message
news:O634UKCWGHA.1192@TK2MSFTNGP04.phx.gbl...
> My issue is to get background processing done that will eventually update
> some of the databinds, i.e. the UI thread (I guess).
>
> Scenario: I do a request to a web service to fetch some products. I don't
> want to block the UI, but the UI needs to be aware that the data
> representing the products has been updated.
>
> My approach seem to work except if I do a sleep. Perhaps I'll just add a
> sleep on the web service itself to do my tests
>
> Thanks
>
> Phil
>
> PS I'll start reading your whitepaper ASAP.
>
> Nick Kramer [MSFT] wrote:
>> Animations & storyboards, along with input processing, layout, data
>> binding, and a few other things, happen on the UI thread, so if the UI
>> thread is sleeping, those things won't get done.
>> https://blogs.msdn.com/nickkramer/ar...17/553378.aspx has more
>> details on WPF threading.
>>
>> Why it's pausing the video is well is a little more of a mystery to me --
>> once the movie is started, the rendering happens on a different thread
>> (the render thread). All I can figure is maybe at some point, the movie
>> needs to synchronize the clock with the storyboard, and at that point
>> gets stuck waiting for the UI thread.
>>
>> -Nick Kramer [MSFT]
>>
>> ---
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> Use of included script samples are subject to the terms specified at
>> http://www.microsoft.com/info/cpyright.htm
>>
>> "Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message
>> news:uTDZw$QVGHA.6084@TK2MSFTNGP14.phx.gbl...
>>
>>>Hi
>>>
>>>To fake a slow connection, I do Thread.Sleep(random_delay);
>>>However when I do that, it stops the movies on the screen (actually a
>>>single movie). It also stops my story boards.
>>>
>>>That Thread.Sleep is a delegate function called through the following
>>>
>>>Application app = Application.Current;
>>>
>>>app.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background,
>>> new GetProductList(this.PopulateProductListHandler));
>>>
>>>Anyways, I can fix this behavior?
>>>
>>>Thanks
>>>
>>>Phil

>>
>>


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Start a new thread from an existing thread, which was started from atimer Curious .NET General 1 06-13-2008 01:36 PM
System locks up in sleep mode on Vista ECU Jack Vista performance & maintenance 0 06-08-2008 01:49 PM
thread gsequeira General Discussion 1 02-13-2008 10:01 PM
Locks up on "Sleep" Rick Vista General 3 01-31-2008 11:10 AM
Another movies thread n Pelethan General Discussion 0 11-19-2006 02:19 PM


Update your Vista Drivers Update Your Vista Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008
Page generated in 0.26900 seconds with 10 queries