Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Thread.Sleep locks my movies. Why?

 
 
Old 03-31-2006   #1 (permalink)
Philippe Lavoie


 
 

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]


 
 

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


 
 

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]


 
 

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
 

Thread Tools


Similar Threads
Thread Forum
Computer just locks when I put it to sleep General Discussion
How do the current thread get thread notification of OS intruption .NET General
Start a new thread from an existing thread, which was started from atimer .NET General
System locks up in sleep mode on Vista Vista performance & maintenance
Another movies thread n General Discussion


Vista Forums 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 Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46