Skip to Content.
Sympa Menu

freetds - Re: [freetds] siginterrupt

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: christos AT zoulas.com (Christos Zoulas)
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] siginterrupt
  • Date: Mon, 28 Jan 2008 11:39:04 -0500

On Jan 28, 11:15am, jklowden AT freetds.org ("James K. Lowden") wrote:
-- Subject: Re: [freetds] siginterrupt

| Christos Zoulas wrote:
| > On Jan 28, 8:53am, jklowden AT freetds.org ("James K. Lowden") wrote:
| > -- Subject: Re: [freetds] siginterrupt
| >
| > | ZIGLIO, Frediano, VF-IT wrote:
| > | > I finally found why signal handling can be so different from system
| > | > to system. The reason is RESTART flag. If this flag is set select do
| > | > not interrupt and return EINTR but just continue.
| > |
| > | My copy of Steven's UNP is at home. I think that flag may not be
| > | standard?
| >
| > It is best practice to assume that it is not set and handle the INTR in
| > a loop:
| >
| > http://www.opengroup.org/pubs/online/7908799/xsh/select.html
|
| Especially because:
|
| "If SA_RESTART has been set for the interrupting signal, it is
| implementation-dependent whether select() restarts or returns with
| [EINTR]."
|
| Some "standard". The option exists but what it does varies.

My list why select(2) is bad and poll(2) should be preferred:

1. Expensive because you need do operations on bitmasks [ffs/shifts].
2. Expensive because you need to reset the masks before each call.
3. Non portable behavior for >= 256 fd's. All systems need source
recompilation; some older systems need kernel recompilation.
4. Non-portable behavior with respect to E_RESTART.
5. Non-portable behavior when running out of resources. The only
way to fix this is using non-blocking-io which is a bit of a pain.
6. Non-portable behavior with respect to "struct timeval *timeout".
This is non-const, and it was originally intended to return
the time left. Most implementations did not change "timeout", but
one or two did, so it is always good to re-initialize "timeout".
Some of these issues have been fixed with pselect(2).
7. Can only report 3 types of events, read/write/except.

There are a few problems with poll(2), that have been fixed in pollts(2),
but pollts(2) is non-standard.

christos




Archive powered by MHonArc 2.6.24.

Top of Page