1
vote
1answer
44 views

Split download file buffer by any number of threads

This is my first attempt at splitting the download buffer into several threads by the number provided. I want to improve on performance and better implementation approach. ...
0
votes
2answers
59 views

Python UDP-server and JSON parser script

I am a python beginner. I wrote a script which should run on a raspberry PI as an UDP server. It is reading and writing to a serial device and has to process and forward JSON strings too. Because ...
4
votes
0answers
212 views

Multithreaded file downloader using threading and signals

This is my first attempt to write a multithreaded application that downloads files from internet. I am looking for improvement in code, logic and better strategy for implementation. Please ignore the ...
2
votes
1answer
27 views

Proxy using socket, doubts on multithreading and connection closing

I'm trying to make a simple proxy server in Python using the socket library, mostly to understand how it works. I'm a noob both at programming and networking, so please be nice if my questions are ...
4
votes
2answers
40 views

Download URL from clipboard

This is a Python script I made to download a URL from the clipboard. When a new URL is copied to a clipboard it adds the URL to a download queue, then on a separate thread it downloads the URL to a ...
2
votes
1answer
57 views

Inline script routine for Open Sesame experiment

I am new to Python as well as threading and had to build an inline script routine for the use within a Open Sesame Experiment. The Routine should open a program, play tones and catch reaction times. ...
3
votes
1answer
75 views

Is the way I used threading in Python correct?

I'm learning how to use Python with the Raspberry Pi. I successfully followed the tutorial for how to have a Python script run on the Pi to check for new email and turn on a LED if any new messages ...
4
votes
1answer
328 views

A simple little Python web crawler

The crawler is in need of a mechanism that will dispatch threads based on network latency and system load. How does one keep track of network latency in Python without using system tools like ping? ...
3
votes
1answer
400 views

Run a TCP server listening for incoming messages

I've written the following code, but I need some review on design style. I want to develop a library/module and expose an API to client programs. How do I do that? The code just runs a TCP server ...
3
votes
1answer
44 views

Invoke only by a single thread

I wrote a simple class in Python, which controls code invocation, in a multi-threaded environment, with the following logic: The class' main method, named ...
3
votes
2answers
898 views

Python Port Scanner

This is only my third Python script. Be brutal with me. Any tips, tricks, best practices, or better usages would be great! ...
2
votes
0answers
126 views

Python app-level document/record locking (eg. for MongoDB)

Introduction MongoDB does not provide means to lock a document (like SELECT FOR UPDATE in RDBMS). There is recommended approach to Isolate Sequence of Operations, which is sometimes called ...
2
votes
1answer
137 views

Pausing and Manipulating Data in a Process with a GUI [closed]

I think I have fixed the issues which caused this program to not be functional. Now I believe the design of my code is somewhat bad and may be causing problems with the number of processes that are ...
6
votes
2answers
316 views

Is this code thread-safe?

EDIT: The full source code in question can be found here. Is this code reasonably safe against dead/livelocks, and if not, how can I fix it? I know processes are usually recommended over threads ...
3
votes
1answer
115 views

Polling multiple servers

I have an application which polls a bunch of servers every few minutes. To do this, it spawns one thread per server to poll (15 servers) and writes back the data to an object: ...
1
vote
1answer
672 views

Multi-threaded socket client for Scrolls

https://github.com/david-torres/ScrollsSocketClient ...
1
vote
1answer
166 views

Feedback on a Python 'sleeping barber' program

I recently came across the Sleeping Barber problem and found out that it is a good place to start learning how to use threads properly. I don't have too much experience with threads and want to ...
2
votes
2answers
169 views

Criticize my threaded image downloader

I'm going to be working on a much larger version of this program and I just wanted to see if there was anything I should change in my style of coding before I made anything larger. If it wasn't ...
2
votes
1answer
58 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
301 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 ...
2
votes
1answer
331 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
105 views

Exclusive Queue Implementation from Little book of semaphores [closed]

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
609 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 ...
3
votes
2answers
345 views

Is Event.wait necessary here?

When I read some code,I think the usage of Event is not necessary,is it right? ...
1
vote
1answer
936 views

Custom thread-pooling

Any suggestions/improvements for the following custom thread-pool code? ...
1
vote
1answer
159 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 ...
2
votes
1answer
523 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 ...
3
votes
1answer
3k 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 ...