multithreading

How to write async background workers that work on WPF flowdocument

I'm trying to write a background worker that processes a flowdocument. I can't access the properties of flowdocument objects because of the thread verification. I tried to serialize the document and loaded it on the worker thread which actually solved the thread verfication issue. However, once the processing is complete I also need t...

Execuitng script in threads

Hi. I wanna make an app that executes remote scripts. I am going to design it like a Windows Service that listen on tcp/ip port. Every new request I will execute a python scripts. So I can handle any number of tcp/ip request at same time, so I will need to execute python script in separate threads. How can I do that? Is that simple? T...

remote function with pthread

Hi all, I wrote some code in c, using pthread (I configured the linker and compiler in eclipse IDE first). #include <pthread.h> #include "starter.h" #include "UI.h" Page* MM; Page* Disk; PCB* all_pcb_array; void* display_prompt(void *id){ printf("Hello111\n"); return NULL; } int main(int argc, char** argv) { printf("H...

Need help with threads in a client/server

For college, I am developing a local relay chat. I have to program a chat server and client that will only work on sending messages on different terminal windows on the same computer with threads and fifos. The fifos part I am having no trouble, the threads part is the one that is giving me some headaches. The server has one thread for...

Thread won't stop when I want it to? (Java)

I have a thread in my screen recording application that won't cooperate: package recorder; import java.awt.AWTException; import java.awt.Insets; import java.io.IOException; import javax.swing.JFrame; public class RepeatThread extends Thread { volatile boolean stop; public volatile Thread recordingThread; JFrame frame; ...

Safe, standard way to load images in ListView on a different thread?

Before making this question, I have searched and read these ones: http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview http://stackoverflow.com/questions/1409623/android-issue-with-lazy-loading-images-into-a-listview My problem is I have a ListView, where: Each row contains an ImageView, whos...

Boost Thread Synchronization

I don't see synchronized output when i comment the the line wait(1) in thread(). can I make them run at the same time (one after another) without having to use 'wait(1)'? #include <boost/thread.hpp> #include <iostream> void wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); } boost::mutex mutex; ...

PerformSelectorInBackground leaking on device

While it seems to not pose a problem on the simulator, using performSelectorInBackground on the device causes memory leaks. Or at least that's what Instruments indicates. Looking at the code I don't have a single clue what the cause could be. I tried to strip the affected code to a bare minimum but still strangely Instruments keeps show...

Java problem with multiple threads when executing a runnable jar file

I have developed a Java Swing application, which uses the SwingWorker class to perform some long running tasks. When the application is run from the IDE (Netbeans), I can start multiple long running tasks simultaneously without any problem. I created a runnable jar file for the application, in order to be able to run it from outside the...

Why is my Map broken?

Scenario: Creating a server which has Room objects which contain User objects. I want to store the rooms in a Map of some sort by Id (a string). Desired Behavior: When a user makes a request via the server, I should be able to look up the Room by id from the library and then add the user to the room, if that's what the request needs. ...

Console appliction with Multithreading on Single core.

Possible Duplicate: Will Multi threading increase the speed of the calculation on Single Processor Hello all, I am reposting my question on Multithreading on Single core processor. Original question is: http://stackoverflow.com/questions/2856239/will-multi-threading-increase-the-speed-of-the-calculation-on-single-processor ...

Access denied from another thread

Hello! In a program I span a thread ("the working thread"). Hera I copy some files write some data to a database and eventually, delete some other files or directories. Everything works fine. The problem is now, that I decided to move the deleting operation to some other thread. So the working thread now copies the files or directories,...

Do I need to use locking with integers in c++ threads

The title says it all really. If I am accessing a single integer type (e.g. long, int, bool, etc...) in multiple threads, do I need to use a synchronisation mechanism such as a mutex to lock them. My understanding is that as atomic types, I don't need to lock access to a single thread, but I see a lot of code out there that does use lo...

Handle leaks with .NET System.Threading.Thread class

I've a problem that number of Handles in my app is continuously growing. I did the debugging and recognize that this is caused by System.Threading.Thread class which is used for some routine. To simplify the debugging I’ve created a sample .NET application: ... private void button1_Click(object sender, EventArgs e) { ...

Why .NET does not allow cross-thread operations?

Possible Duplicate: .NET Controls: Why arent all calls thread-safe? This question is not about what is a cross-thread operation, and how to avoid it, but why internal mechanics of .NET framework does not allow a cross-thread operation. I can`t understand why a SerialPort DataReceived event cannot update a simple text box on ...

My app crashes on Iphone SDK 3.2

Hi Guys, My app worked ok on iPhone SDK 3.1. However, when I try to run it in 3.2 simulator, I get the following error and it crashes: bool _WebTryThreadLock(bool), 0x5148280: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashin...

.Net Entity objectcontext thread error

I have an n-layered asp.net application which returns an object from my DAL to the BAL like so: public IEnumerable<SourceKey> Get(SourceKey sk) { var query = from SourceKey in _dataContext.SourceKeys select SourceKey; if (sk.sourceKey1 != null) { query = from SourceKey in query where ...

Threading process in asp.net

Hi All, I am using asp.net 3.5 and C#. I have a blog site and I want that whenever user enter any comment, the suscriber related to that post will get the notification. So what I am doing that I am sending mail at the same time as the comment is inserted into the table, which sometimes take time because of the quantity of user. Is thei...

Faking a Single Address Space

I have a large scientific computing task that parallelizes very well with SMP, but at too fine grained a level to be easily parallelized via explicit message passing. I'd like to parallelize it across address spaces and physical machines. Is it feasible to create a scheduler that would parallelize already multithreaded code across mult...

How long does it take each thread timeslice in Windows XP ?

I am trying to find out how long does it take each thread timeslice (quantum) in Windows but the only information that I found out is about the clock ticks being from 15 to 20ms or 20-30ms. How can I find this information ? I think it may vary from OS to OS, but I am not certain. I appreciate any suggestion on this subject. Thank you. ...