Changeset d199ced for fedd/fedd.py


Ignore:
Timestamp:
Oct 14, 2008 5:35:15 PM (16 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
3925b50
Parents:
0b466d1
Message:

upgrade

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd.py

    r0b466d1 rd199ced  
    2020from threading import *
    2121from signal import signal, pause, SIGINT, SIGTERM
    22 from select import select
     22from select import select, error
    2323from time import sleep
    2424import logging
     
    251251    """
    252252    global servers_active, flog
     253
    253254    servers_active = False
    254255    flog.info("Received signal %d, shutting down" % sig);
     
    267268
    268269    while servers_active:
    269         i, o, e = select((s,), (), (), 5.0)
    270         if s in i: s.handle_request()
     270        try:
     271            i, o, e = select((s,), (), (), 1.0)
     272            if s in i: s.handle_request()
     273        except error:
     274            # The select call seems to get interrupted by signals as well as
     275            # the main thread.  This essentially ignores signals in this
     276            # thread.
     277            pass
    271278
    272279    # Done.  Remove us from the list
     
    356363# Main thread waits for signals
    357364while servers_active:
    358     pause()
     365    sleep(1.0)
    359366
    360367#Once shutdown starts wait for all the servers to terminate.
Note: See TracChangeset for help on using the changeset viewer.