Skip to content

Commit

Permalink
Disable gevent
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam DePrince committed Mar 4, 2013
1 parent e234484 commit a8a1cee
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions autosync/daemon.py
@@ -1,9 +1,36 @@

use_gevent = False

import select import select
from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent
import gevent
from gevent import queue, spawn, joinall if use_gevent:
from gevent.queue import Queue import gevent
from gevent.monkey import patch_all from gevent import spawn, joinall
from gevent.queue import Queue
from gevent.monkey import patch_all
else:
import thread
from Queue import Queue
# Duplicate gevent's semantics with thread
def spawn(func, *args, **kwargs):
def join_emulator(func, lock, *args, **kwargs):
func(*args, **kwargs)
lock.release()

lock = thread.allocate_lock()
lock.acquire(True)

args = (lock,) + tuple(args)
return thread.start_new_thread(func, args, kwargs)

def joinall(locks):
for lock in locks:
lock.acquire(True)
lock.release(True)



import autosync import autosync
import autosync.actors import autosync.actors
import autosync.actors.s3 import autosync.actors.s3
Expand All @@ -12,7 +39,8 @@


import gflags import gflags


patch_all(select=False) if use_gevent:
patch_all(select=False)


FLAGS = gflags.FLAGS FLAGS = gflags.FLAGS


Expand Down

0 comments on commit a8a1cee

Please sign in to comment.