multithreading

Threaded code on mod_python

I have written a Django app that makes use of Python threading to create a web spider, the spider operates as a series of threads to check links. When I run this app using the django test server (built in), the app runs fine and the threads seem to start and stop on time. However, running the app on Apache it seems the threads aren't k...

Loading lots of upfront data. . sync or async . .

so i have a winforms apps that downloads a set of data syncronously on startup. This obviously takes a while but then when any of the services or GUI classes load, they all have this data. I could change this to put on a background thread but then every component that needs access to this data would continuously have to get notified wh...

Multi-threading: Objects being set to null while using them.

I have a small app that has a Render thread. All this thread does is draw my objects at their current location. I have some code like: public void render() { // ... rendering various objects if (mouseBall != null) mouseBall.draw() } Then I also have some mouse handler that creates and sets mouseBall to a new ball when the ...

How to limit execution time of a function call in Python

There is a socket related function call in my code, that function is from another module thus out of my control, the problem is that it blocks for hours occasionally, which is totally unacceptable, How can I limit the function execution time from my code? I guess the solution must utilize another thread. ...

Python multiprocessing misunderstandings...

Hi, I am having trouble with the python multiprocessing module. I am using the Process() class to spawn a new process in order to utilize my second core. This second process loads a bunch of data into RAM and than waits patiently instead of consuming. Anyway, I just wanted to see what that process printed with the "print" command; howe...

SqlDataReader throws NullReferenceException! what could cause this and how can I debug?

I found this in an error log and am trying to work out how it's possible. It's not every day that a NullReferenceException turns up deep within the .net base classes! 1) Exception Information ********************************************* Exception Type: System.NullReferenceException Message: Object reference not set to an instance of an...

Changing async call implementation using a ManualResetEvent to one using a combination of Thread methods

I'm looking for a design pattern to switch from using a ManualResetEvent to using Thread methods like Thread.Join. Right now I'm making an async call and then using a ManualResetEvent to wait till the async call finishes before continuing on the thread that made the call. I'd be glad for any implementation that would produce more stable...

C#: WebBrowser.Navigated Only Fires when I MessageBox.Show();

I have a WebBrowser control which is being instantiated dynamically from a background STA thread because the parent thread is a BackgroundWorker and has lots of other things to do. The problem is that the Navigated event never fires, unless I pop a MessageBox.Show() in the method that told it to .Navigate(). I shall explain: ThreadSt...

How to create a form on its own thread and keep it open throughout application lifetime

I am creating a little testing component and am running into a problem Basically the component is a decorator on a class that controls all access to the database, it creates a form with a two buttons on it: "Simulate Lost Connection" and "Reconnect". Press the button, and instead of letting function calls pass through the wrapper start...

Can I use multithreading with Perl's DBI and Oracle?

Does anyone know of any gotachs or problems when writing multithreaded Perl applications using the Oracle DBI? Each thread would have it's own connection to Oracle. For the longest time I was told multithreading was not supported in Perl with Oracle. ...

Is a multi-user and multi-processor environment useful with threading?

Taking CPU affinity into account, will such an environment be useful with threading? Or will there be a performance degradation in such a system, if multiple users login and spawn multiple kernel and user threads? ...

Manage ADO.NET Entity Framework ObjectContext in ASP.NET MVC

I'm using ADO.NET EF in an MVC application. I'm considering putting the ObjectContext inside HttpContext.Current so that all logic in the same request can access to it without having to open/destroy each time. However, I'm really sure if it's a good way to manage ObjectContext instances. I have 2 questions regarding this need: As Ht...

SSL Socket in Windows. Library? Synchronous/Asynchronous? Threads?

Hello I have a 2 threads application. One GUI thread and one worker thread (CWinThread) in which I make time consuming operations - calculations and HTTP comunication. I have to switch from HTTP to SSL socket connection. I also need to make a verification of server certificate (is it trusted, is it expired, is it revoked) Which libr...

Asynchronous vs Synchronous vs Threading in an iPhone App

I'm in the design stage for an app which will utilize a REST web service and sort of have a dilemma in as far as using asynchronous vs synchronous vs threading. Here's the scenario. Say you have three options to drill down into, each one having its own REST-based resource. I can either lazily load each one with a synchronous request, bu...

How to block the UI thread from another thread or force a form to run within the UI thread

A requirement for my application is if it looses database connectivity then it must pop up a big modal "No Connection. Try again later" dialog blocking all user interaction until such time that connectivity is regained. I achieve this by at the start of the application starting an instance of a DeviceMonitor class. This class creates ...

Proper way to get a Winforms UI to block with a dialog until some non-user driven event conditioin?

I was asking about specifics with this approach earlier today here but the confused responses has me wondering if I'm going about this all wrong. So here's the problem. I need to architect a WinForms application that periodically checks a value from some external service. If it is in a certain state the application is supposed to pop ...

How do I create a new windows form, and associate it with an already existing thread?

I'm trying to write a chat client in C# and have run into a problem. How it works is that the client polls the server every 1 second to see if there are any new actions to take (for example display a message in a channel, or whatever). The polling is done in a thread of its own. Now, I want the polling thread to open a new MDI form whe...

How do you measure code block (thread) execution time with multiple concurrent threads in .NET

Right now we just use something like this stopWatch.Start(); try { method(); } finally { stopWatch.Stop(); } Which works fine for synchronous methods, but some are executing asynchronously, so the time is skewed when multiple threads are execut...

Multi-threaded file transfer to a FTP server

I am writing a client for a backup server. My client schedules some folders for backup. (ex: every friday at hour X). I am using for scheduling cron4j (a port of Linux cron to java). Everything works nice until i schedule at the same time multiple upload jobs, then due to the multiple threads it gets messy. Can anyone help me with a so...

Many threads or as few threads as possible?

As a side project I'm currently writing a server for an age-old game I used to play. I'm trying to make the server as loosely coupled as possible, but I am wondering what would be a good design decision for multithreading. Currently I have the following sequence of actions: Startup (creates) -> Server (listens for clients, creates) ->...