My bad cut the post to short, i will try to reexplain:

I make my worker object and create a thread, then move the object to the thread and start the thread.

the started signal of the thread is connected to the slot of the worker i want to run e.g (comets_to_use() ).

the worker contains a slot called on_shut_down_threads(). inside that i was using QThread::currentThread() to access the thread that was executing the worker. So i press a button and that emits a signal with is connected to this worker slot.

So this worker is in the worker thread:

Qt Code:
  1. void Worker:on_shut_down_threads()
  2. {
  3. QThread::currentThread()->exit();
  4. }
To copy to clipboard, switch view to plain text mode 

Since i want to close down the calculations in the slot comets_to_use() before it has finished I'm trying to find a way shut down that thread/or stop executing that worker slot.

yes emitting the signal ->quit() was dumb.

i still dont see why my thread does not close if i run

Qt Code:
  1. active_threads[i]->terminate();
To copy to clipboard, switch view to plain text mode 
or:
Qt Code:
  1. active_threads[i]->exit();
To copy to clipboard, switch view to plain text mode 

from the main thread thow?