jgeiger
Posts: 21
Joined: Sat Sep 20, 2008 2:14 am

Thread not closing?

Wed Oct 29, 2008 1:50 am

In both PDA and PC applications, I am having a problem where when I close the program (runtime or in debug mode), it doesn't seem to fully close, and I believe it is related to the Bluetools application. (The problem existed on PDA, never on PC, then I ported all of my bluetooth code over to PC and now it does it.) Is there best practice for discarding all bluetools objects on exit, to make sure all threads it may be using are also terminated?

I've tried this with no success:

manager = null;
m_network = null;
currentService = null;
BTstream = null;

I don't see anything differently being done in the FindAndConnect example, but that example does not have the same problem.

Just looking for suggestions.

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: Thread not closing?

Wed Oct 29, 2008 9:08 am

The important thing is to Dispose of the manager. If you have events that is still firing those might prevent your application from shutting down as well.

Regards,
Jonas

jgeiger
Posts: 21
Joined: Sat Sep 20, 2008 2:14 am

RE: Thread not closing?

Thu Oct 30, 2008 6:46 pm

That was my mistake. I was setting it to null, but not disposing of it. NOw that I've got manager.Dispose() in there, all is fine

Thank you very much.

One problem down...

tomas.teijeiro
Posts: 7
Joined: Wed Jan 21, 2009 10:03 pm
Location: Spain

RE: Thread not closing?

Thu Feb 19, 2009 6:59 pm

It would be possible that Bluetools threads to run in background mode? It's annoying the requirement of disposing the manager, because of main program would not know that Bluetools is being used in internal modules.

Best Regards,

Tomás

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: Thread not closing?

Thu Feb 19, 2009 7:10 pm

There is no such plans at the moment.

Regards,
Jonas

Return to “BlueTools”