SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Deadlock problem in .NET compact framework 1.1 - multithread

Last post 07-11-2008 3:48 PM by waghmarerajendra. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 07-11-2008 3:48 PM

    Deadlock problem in .NET compact framework 1.1 - multithread

     Hi,

    I am working in C# .NET compact framework 1.1 and developing WINCE based application and running it on .NET emulator.

    I am developing an application where there is an UI and some background processing. On UI there are start, stop, pause, and resume buttons and a progress bar. When I click on start I am updating progress bar value with value starting from 1. When that value goes to 20 progress bar is full.
    Now I have pause button to pause the progress bar. If I click on pause it should pause until I press resume. If I press on stop, progress bar should stop.

    To achieve this I have created one thread after clicking on start button and passed UpdateProgressbar function to it. Where it checks count < 20 and updates progress bar if pause button flag is set it goes into 100ms-sleep And after coming out of this 100ms sleep checks resume flag, if it is set it continues updating progress bar else again goes to 100ms sleep.

    Now the problem is :-
    1) After clicking on start progress bar may or may not update. Some times it updates to some value lets say 6 and then hangs and I am not able to press any button or control on form
    2)I tried using Sleep() in click button and UpdateProgressbar function but it doesn't work always.

    In short there is a deadlock! I am not able to figure it out and resolve
    Can anybody help?


    Many many thanks in advance!
Page 1 of 1 (1 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.