Welcome, Guest. Please login or register.

Author Topic: Threads, revisited  (Read 3120 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show all replies
Re: Threads, revisited
« on: February 24, 2007, 03:13:53 PM »
Quote

The stop() method will not return until the process has ended. Calling stop will also interrupt any sleep state the thread is presently in (from calling Thread::sleep()), causing it to return a value signifying that the thread has been asked to quit.


What if thread in question is waiting for input from a thread that called stop() ?
My Amigas: A500, Mac Mini and PowerBook
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show all replies
Re: Threads, revisited
« Reply #1 on: February 25, 2007, 11:05:48 AM »
It is. While spawning new processes is very cheap in AmigaDOS in Ambient, which uses threading heavily, we have always few spare processes waiting for work.
My Amigas: A500, Mac Mini and PowerBook
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show all replies
Re: Threads, revisited
« Reply #2 on: February 25, 2007, 03:27:58 PM »
Yep, that is right.

In C++ (Ambient is purely C with MUI) you could also consider implementing thread pool where C++ thread objects allocate threads from the pool... maybe overkill though...
My Amigas: A500, Mac Mini and PowerBook
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show all replies
Re: Threads, revisited
« Reply #3 on: February 25, 2007, 04:51:27 PM »
Ah well :) Just a thought.
My Amigas: A500, Mac Mini and PowerBook