PC Review


Reply
Thread Tools Rate Thread

Leaving threads open??

 
 
=?Utf-8?B?Um9iIFM=?=
Guest
Posts: n/a
 
      10th Jun 2005
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.

 
Reply With Quote
 
 
 
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      10th Jun 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" <(E-Mail Removed)> wrote in message
news:B6017C82-DC29-4D57-BF96-(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
=?Utf-8?B?Um9iIFM=?=
Guest
Posts: n/a
 
      13th Jun 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" <(E-Mail Removed)> wrote in message
> news:B6017C82-DC29-4D57-BF96-(E-Mail Removed)...
> > 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.
> >

>
>
>

 
Reply With Quote
 
Steve Maillet \(eMVP\)
Guest
Posts: n/a
 
      13th Jun 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


 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      13th Jun 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" <(E-Mail Removed)> wrote in message
news:106A9AF1-9B0E-4D45-9562-(E-Mail Removed)...
>
> 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" <(E-Mail Removed)> wrote in message
>> news:B6017C82-DC29-4D57-BF96-(E-Mail Removed)...
>> > 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.
>> >

>>
>>
>>



 
Reply With Quote
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      13th Jun 2005
It's not a matter of closing the thread handle, but *having the thread
exit*. See what I mean?

Paul T.

"Rob S" <(E-Mail Removed)> wrote in message
news:106A9AF1-9B0E-4D45-9562-(E-Mail Removed)...
>
> 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" <(E-Mail Removed)> wrote in message
>> news:B6017C82-DC29-4D57-BF96-(E-Mail Removed)...
>> > 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.
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quit is leaving access open Roofus Microsoft Access Macros 4 22nd Sep 2009 12:06 PM
Web app leaving SQL database connections open Robin9876 Microsoft ASP .NET 2 20th Nov 2008 06:21 PM
Word 2007: Closing Last Doc & Leaving App Open CompTutor Microsoft Word Document Management 1 6th Jan 2008 09:57 PM
PictureBox leaving filehandle open Jeff Williams Microsoft C# .NET 1 26th Mar 2007 04:58 PM
Leaving DB open dave h Microsoft Access Queries 2 22nd Mar 2005 01:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:51 PM.