Hi there,

Have an issue with my .NET application.

Basically the problem is it runs fine the first time and then when i close
it (from settings > memory) it no longer starts when i click on the icon,
literally does nothing.

This started happening after i'm now using notifications to run a specific
thread every 5 minutes.

In my form_closing event i run this code:


if ( timedSyncThread != null )
{
EventWaitHandle notifyEvent = new OpenNETCF.Threading.EventWaitHandle(
false,
OpenNETCF.Threading.EventResetMode.AutoReset,
"SAMS_SYNC_EVENT" );

// Notify the thread to stop.
notifyEvent.Set();

notifyEvent.Close();

..but i still have this problem.

Any ideas?

PS. Works fine again after a soft reset.

Re: Leaving threads open?? by Chris

Chris
Fri Jun 10 08:33:48 CDT 2005

I don't see the thread side of this? How does it receive the notice to end
and then exit itself?

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate


"Rob S" <RobS@discussions.microsoft.com> wrote in message
news:B6017C82-DC29-4D57-BF96-0543A48E05FE@microsoft.com...
> Hi there,
>
> Have an issue with my .NET application.
>
> Basically the problem is it runs fine the first time and then when i close
> it (from settings > memory) it no longer starts when i click on the icon,
> literally does nothing.
>
> This started happening after i'm now using notifications to run a specific
> thread every 5 minutes.
>
> In my form_closing event i run this code:
>
>
> if ( timedSyncThread != null )
> {
> EventWaitHandle notifyEvent = new OpenNETCF.Threading.EventWaitHandle(
> false,
> OpenNETCF.Threading.EventResetMode.AutoReset,
> "SAMS_SYNC_EVENT" );
>
> // Notify the thread to stop.
> notifyEvent.Set();
>
> notifyEvent.Close();
>
> ..but i still have this problem.
>
> Any ideas?
>
> PS. Works fine again after a soft reset.
>



Re: Leaving threads open?? by RobS

RobS
Mon Jun 13 03:18:01 CDT 2005


Thanks for the reply Chris, although i'm not totally sure what more i can
say to explain the problem.

It's opening a new thread with this line of code:

timedSyncThread = new OpenNETCF.Threading.ThreadEx(new
ThreadStart(this.SetSyncTime));
timedSyncThread.Start();

and it does that every 5 minutes.

on the closing event of my application it attempts to close that thread but
the application just doesn't re-open until i soft-reset.

What could be causing that?

Many Thanks,
Rob


"Chris Tacke, eMVP" wrote:

> I don't see the thread side of this? How does it receive the notice to end
> and then exit itself?
>
> --
> Chris Tacke
> Co-founder
> OpenNETCF.org
> Are you using the SDF? Let's do a case study.
> Email us at d c s @ o p e n n e t c f . c o m
> http://www.opennetcf.org/donate
>
>
> "Rob S" <RobS@discussions.microsoft.com> wrote in message
> news:B6017C82-DC29-4D57-BF96-0543A48E05FE@microsoft.com...
> > Hi there,
> >
> > Have an issue with my .NET application.
> >
> > Basically the problem is it runs fine the first time and then when i close
> > it (from settings > memory) it no longer starts when i click on the icon,
> > literally does nothing.
> >
> > This started happening after i'm now using notifications to run a specific
> > thread every 5 minutes.
> >
> > In my form_closing event i run this code:
> >
> >
> > if ( timedSyncThread != null )
> > {
> > EventWaitHandle notifyEvent = new OpenNETCF.Threading.EventWaitHandle(
> > false,
> > OpenNETCF.Threading.EventResetMode.AutoReset,
> > "SAMS_SYNC_EVENT" );
> >
> > // Notify the thread to stop.
> > notifyEvent.Set();
> >
> > notifyEvent.Close();
> >
> > ..but i still have this problem.
> >
> > Any ideas?
> >
> > PS. Works fine again after a soft reset.
> >
>
>
>

Re: Leaving threads open?? by Steve

Steve
Mon Jun 13 07:46:31 CDT 2005

You still aren't showing the code of the thread itself. That's likely
causing a problem. (BTW: Why start a new thread every 5 minutes in response
to a notification? Why not just do whatever needs to be done in the
notification handler?)

--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com



Re: Leaving threads open?? by Chris

Chris
Mon Jun 13 09:21:21 CDT 2005

So you're creating a new thread every 5 minutes? What are these threads
doing? How does the thread procedure exit? How does the main app ensure
they are all closed at startup? What I'm saying is we need to see the
architecture of the threads. I'm certain that they're still running when
your app closes, and this is what's preventing you from restarting.

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate


"Rob S" <RobS@discussions.microsoft.com> wrote in message
news:106A9AF1-9B0E-4D45-9562-680EFC4417AF@microsoft.com...
>
> Thanks for the reply Chris, although i'm not totally sure what more i can
> say to explain the problem.
>
> It's opening a new thread with this line of code:
>
> timedSyncThread = new OpenNETCF.Threading.ThreadEx(new
> ThreadStart(this.SetSyncTime));
> timedSyncThread.Start();
>
> and it does that every 5 minutes.
>
> on the closing event of my application it attempts to close that thread
> but
> the application just doesn't re-open until i soft-reset.
>
> What could be causing that?
>
> Many Thanks,
> Rob
>
>
> "Chris Tacke, eMVP" wrote:
>
>> I don't see the thread side of this? How does it receive the notice to
>> end
>> and then exit itself?
>>
>> --
>> Chris Tacke
>> Co-founder
>> OpenNETCF.org
>> Are you using the SDF? Let's do a case study.
>> Email us at d c s @ o p e n n e t c f . c o m
>> http://www.opennetcf.org/donate
>>
>>
>> "Rob S" <RobS@discussions.microsoft.com> wrote in message
>> news:B6017C82-DC29-4D57-BF96-0543A48E05FE@microsoft.com...
>> > Hi there,
>> >
>> > Have an issue with my .NET application.
>> >
>> > Basically the problem is it runs fine the first time and then when i
>> > close
>> > it (from settings > memory) it no longer starts when i click on the
>> > icon,
>> > literally does nothing.
>> >
>> > This started happening after i'm now using notifications to run a
>> > specific
>> > thread every 5 minutes.
>> >
>> > In my form_closing event i run this code:
>> >
>> >
>> > if ( timedSyncThread != null )
>> > {
>> > EventWaitHandle notifyEvent = new OpenNETCF.Threading.EventWaitHandle(
>> > false,
>> > OpenNETCF.Threading.EventResetMode.AutoReset,
>> > "SAMS_SYNC_EVENT" );
>> >
>> > // Notify the thread to stop.
>> > notifyEvent.Set();
>> >
>> > notifyEvent.Close();
>> >
>> > ..but i still have this problem.
>> >
>> > Any ideas?
>> >
>> > PS. Works fine again after a soft reset.
>> >
>>
>>
>>



Re: Leaving threads open?? by Paul

Paul
Mon Jun 13 10:26:22 CDT 2005

It's not a matter of closing the thread handle, but *having the thread
exit*. See what I mean?

Paul T.

"Rob S" <RobS@discussions.microsoft.com> wrote in message
news:106A9AF1-9B0E-4D45-9562-680EFC4417AF@microsoft.com...
>
> Thanks for the reply Chris, although i'm not totally sure what more i can
> say to explain the problem.
>
> It's opening a new thread with this line of code:
>
> timedSyncThread = new OpenNETCF.Threading.ThreadEx(new
> ThreadStart(this.SetSyncTime));
> timedSyncThread.Start();
>
> and it does that every 5 minutes.
>
> on the closing event of my application it attempts to close that thread
> but
> the application just doesn't re-open until i soft-reset.
>
> What could be causing that?
>
> Many Thanks,
> Rob
>
>
> "Chris Tacke, eMVP" wrote:
>
>> I don't see the thread side of this? How does it receive the notice to
>> end
>> and then exit itself?
>>
>> --
>> Chris Tacke
>> Co-founder
>> OpenNETCF.org
>> Are you using the SDF? Let's do a case study.
>> Email us at d c s @ o p e n n e t c f . c o m
>> http://www.opennetcf.org/donate
>>
>>
>> "Rob S" <RobS@discussions.microsoft.com> wrote in message
>> news:B6017C82-DC29-4D57-BF96-0543A48E05FE@microsoft.com...
>> > Hi there,
>> >
>> > Have an issue with my .NET application.
>> >
>> > Basically the problem is it runs fine the first time and then when i
>> > close
>> > it (from settings > memory) it no longer starts when i click on the
>> > icon,
>> > literally does nothing.
>> >
>> > This started happening after i'm now using notifications to run a
>> > specific
>> > thread every 5 minutes.
>> >
>> > In my form_closing event i run this code:
>> >
>> >
>> > if ( timedSyncThread != null )
>> > {
>> > EventWaitHandle notifyEvent = new OpenNETCF.Threading.EventWaitHandle(
>> > false,
>> > OpenNETCF.Threading.EventResetMode.AutoReset,
>> > "SAMS_SYNC_EVENT" );
>> >
>> > // Notify the thread to stop.
>> > notifyEvent.Set();
>> >
>> > notifyEvent.Close();
>> >
>> > ..but i still have this problem.
>> >
>> > Any ideas?
>> >
>> > PS. Works fine again after a soft reset.
>> >
>>
>>
>>