Multithrading on Pocket PC

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am trying to set up a simple worker thread that handles creating a SQL CE
database using Thread class then starting it. This doesn't seem to work on
the Pocket PC as it does on the desktop.

When I start a thread on Pocket PC as soon as I press a button the thread
seems to stop and the application appears to lock up?

Any ideas
Cheers
Simon
 
Most likely you're updating UI from worker thread without using
Control.Invoke().

That would cause instant lock up on device, infrequent lock ups on desktop.

NETCF V2 will throw on attempt to do that.


Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
My limited expeirence in Multithreaded UI apps is that on the desktop you
need not update the UI thread. Once a worker thread is created it does its
job and ends while giving the end user freedom to interact with other UI
controls.

Simon.
 
By "updating UI" I meant accessing any UI controls from worker thread.



Examples of "updating UI" would be:



textBox1.Text = "Running in background, doing something:";



progressBar2.Value = 10;



If you do anything like this from worker thread, your application will hang.

If you have data source bound to some control, changing data source would
also update UI.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Thanks guys for your help.

I've more or less figured out CF multithreading issues it's certainly less
forgiving than full .NET! which I guess is a good thing..

One last question, what is the recommended way of terminating a worker
thread from a UI thread, for instance the worker thread occurs an exception
and cannot continue the worker thread then calls Control.Invoke to report the
error. It's here that the UI thread needs to shutdown the worker thread.

Cheers
Simon.
 
Back
Top