• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Threads vs Select (was Re: Re(2): [Repost] OTCountFreeBytes? (like OTCountDataBytes but for send))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threads vs Select (was Re: Re(2): [Repost] OTCountFreeBytes? (like OTCountDataBytes but for send))


  • Subject: Re: Threads vs Select (was Re: Re(2): [Repost] OTCountFreeBytes? (like OTCountDataBytes but for send))
  • From: email@hidden
  • Date: Mon, 4 Feb 2002 14:42:11 -0500

On Monday, February 4, 2002, at 11:19 AM, Duane Murphy wrote:

How do you break a thread that is waiting on a read? Or rather what
happens when a thread is killed waiting on a read? Or how do you kill a
thread waiting on read?

If you have a thread waiting on a read and the program wants it to stop
in order to quit or because the user cancelled the request, what is the
right way of doing that?

Seems like just killing the thread doesnt properly unwind the stack so
some things might be left un-clean.

What is the right technique for this?

Have the read timeout at regular intervals, and have your read thread
check a suicide flag to see if it should kill itself. You still have to use select
for this.

If you would rather have a callback implementation, then have only one I/O thread
that implements a select loop, and use it to dispatch the callbacks to your
I/O handlers.

If you are doing OOP, the Reactor pattern is a good model
for this.

email@hidden


References: 
 >Threads vs Select (was Re: Re(2): [Repost] OTCountFreeBytes? (like OTCountDataBytes but for send)) (From: Duane Murphy <email@hidden>)

  • Prev by Date: Re: Network Programming Models (was OTCountFreeBytes?)
  • Next by Date: Re: Network Programming Models (was OTCountFreeBytes?)
  • Previous by thread: Threads vs Select (was Re: Re(2): [Repost] OTCountFreeBytes? (like OTCountDataBytes but for send))
  • Next by thread: Internet Connect in Mac OS X clobbers other software that uses modem
  • Index(es):
    • Date
    • Thread