Tagged Questions
2
votes
2answers
29 views
Refactoring an interruptable thread
I have a long-running task that processes an input file and then uploads it to a web server. The processing part can be interrupted (with cleanup) but the upload shouldn't be interruptable so that we ...
1
vote
1answer
43 views
Alternative to using sleep() to avoid a race condition in PyQt
I have a situation where I would like to use a single QThread to run two (or more) separate methods at different times. For example, I would like the QThread to run play() sometimes, and when I am ...
2
votes
1answer
71 views
Python parallelization using Popen
I frequently run a script similar to the one below to analyze an arbitrary number of files in parallel on a computer with 8 cores.
I use Popen to control each thread, but sometimes run into problems ...
0
votes
1answer
49 views
Exclusive Queue Implementation from Little book of semaphores
I tried implementing the exclusive queue as given in the Little book of semaphores. But I suspect there's a deadlock occurring as i see no progress. Not able to figure out the issue. Any pointers ...
3
votes
2answers
174 views
Improve multithreading with network IO and database queries
I'm writing a script that:
fetch a list of urls from a db (about 10000 urls)
download all the pages and insert them into the db
parse the code
if(some condition) do other inserts into the db
I ...
2
votes
2answers
148 views
Is Event.wait necessary here?
When I read some code,I think the usage of Event is not necessary,is it right?
# start server
while True:
# accept a request here
queue.put(info)
event.set() # notify all the threads?
...
1
vote
1answer
120 views
Custom thread-pooling
Any suggestions/improvements for the following custom thread-pool code?
import threading
from Queue import Queue
class Worker(threading.Thread):
def __init__(self, function, in_queue, ...
1
vote
1answer
113 views
threading objects and urlrequests
The code below is a good representation of my coding skills. I've been at it for about 6 months. What I am interested in is ways to make the following program faster. I currently have the ...
1
vote
1answer
205 views
Is this a safe/correct way to make a python LogHandler asynchronous?
I'm using some slow-ish emit() methods in Python (2.7) logging (email, http POST, etc.) and having them done synchronously in the calling thread is delaying web requests. I put together this function ...
2
votes
1answer
1k views
A simple thread-safe queue in python
I'm trying to implement a kind of message queue. Tasks will come in at unknown random times, and must be executed FIFO. I can do multiple tasks in one hit, but the setup and tear down unavoidably ...