multithreading

How do you put an object in another thread?

Hey folks, is there any way in c# to put objects in another thread? All I found is how to actually execute some methods in another thread. What I actually want to do is to instanciate an object in a new thread for later use of the methods it provides. Hope you can help me, Russo ...

Dispatcher cross thread

Hi I have a WPF Grid and a list of values. The list of values have a row and column property and the content value. There are between 200 and 14,000 values to be displayed in a formatted grid. I have added rows and columns to the grid then added text blocks to the grid in the correct row/column positions. This works great till I have ...

python threading and queues for infinite data input (stream)

Hi All, I would like to use thread to process a streaming input. How can make the below code for an infinite input generate for example by using itertools.count The code below will work if: 'for i in itertools.count():' is replaced by 'for i in xrange(5):' from threading import Thread from Queue import Queue, Empty import itertools...

Android thread main exiting..

I have thread in "onCreate" which is getting content from web. While the content is getting, I have progress dialog. new Thread() { public void run() { Get_content() ; handler.sendEmptyMessage(0); } }.start(); But if I rotate the display (to landscape mode) while this is running, my application gets Force ...

DllMain calls from C# thread creation/deletion seem to be unbalanced?

I'm using a library (ANet) which is written natively in C and I am interfacing with it using C# via a small subset wrapper dll which i've made in C and statically links to it. The library (ANet) has a DllMain which simply tracks the number of references to it (so "Process attach" and "Thread attach" counts) but it seems to go into the ne...

Control concurrency in multiple users web application gridview

Guys i'm with a big problem. I'm running a backoffice application, and imagine, i have a form than contains a gridview editable. 100 Users go to the page 100 Users view the form page as the data provided from database 100 Users edit some fields How control the final data and consistency in this example? ...

Multi-threading on a foreach loop?

I want to process some data. I have about 25k items in a Dictionary. IN a foreach loop, I query a database to get results on that item. They're added as value to the Dictionary. foreach (KeyValuePair<string, Type> pair in allPeople) { MySqlCommand comd = new MySqlCommand("SELECT * FROM `logs` WHERE IP = '" + pair.Key + "' GROUP BY s...

Is there any way to make newly generated threads automatically suspend in Visual Studio?

Hi, Debugging a multithreaded app. I'm freezing threads as I see them created, but I wonder if there is a setting so that newly generated threads are suspended by default? I keep glancing up and seeing new threads running which I don't want! Thanks ...

Is the MS DAAB 4.1 Database object threadsafe?

I've come across some code that has a singleton which creates / reuses a static instance of the MSDAAB Database object. Is the Database object threadsafe after creation? I couldn't find anything one way or the other in the MSDAAB docs. ...

Android Media Player Threading

I have written a Music player app and it works great but when a flip action happens or when I return the the player view I have to stop the player and restart it at the postion that it was at when the action happened. That all works but it means a breif stop and start. How can I run the media player in a different thread and still updat...

How to delete certain characters from multiple text files, in a thread safe way?

What is the best way, to develop a multi threaded program, to delete certain characters from multiple text files that are passed in as parameters? Thus, when someone passes as a.out axvc f1 f2 f3 f4 , the goal is to delete all occurences of the characters a,x,v,c from the file f1, f2, f3 and f4. ...

Boost thread_interrupted exception terminate()s with MinGW gcc 4.4.0, OK with 3.4.5

I've been "playing around with" boost threads today as a learning exercise, and I've got a working example I built quite a few months ago (before I was interrupted and had to drop multi-threading for a while) that's showing unusual behaviour. When I initially wrote it I was using MingW gcc 3.4.5, and it worked. Now I'm using 4.4.0 and i...

Thread with lists

Hello Friends, I have an app that is a little bit slow. I thoutght it could be faster using threads. So, here is my plan: My program have a list of objects of type X and each object X has a very big list of Integers (let's consider Integer for the sake of simplicity). I have a static method (called getSubsetOfX) that receives a object...

Access class functions from another thead?

I have a function in my class that creates a thread and gives it arguments to call a function which is part of that class but since thread procs must be static, I can't access any of the class's members. How can this be done without using a bunch of static members in the cpp file to temporarily give the data to be manipulated, this seems...

What am I doing wrong? (multithreading)

Here s what I'm doing in a nutshell. In my class's cpp file I have: std::vector<std::vector<GLdouble>> ThreadPts[4]; The thread proc looks like this: unsigned __stdcall BezierThreadProc(void *arg) { SHAPETHREADDATA *data = (SHAPETHREADDATA *) arg; OGLSHAPE *obj = reinterpret_cast<OGLSHAPE*>(data->objectptr); for(unsigne...

Java file i/o throughput decline

I have a program in which each thread reads in files many lines at a time from a file, processes the lines, and writes the lines out to a different file. Four threads split the list of files to process among them. I'm having strange performance issues across two cases: Four files with 50,000 lines each Throughput starts at 700 lines...

Multithreading not taking advantage of multiple cores?

My computer is a dual core core2Duo. I have implemented multithreading in a slow area of my application but I still notice cpu usage never exceeds 50% and it still lags after many iterations. Is this normal? I was hopeing it would get my cpu up to 100% since im dividing it into 4 threads. Why could it still be capped at 50%? Thanks See...

Better way to copy several std::vectors into 1? (multithreading)

Here is what I'm doing: I'm taking in bezier points and running bezier interpolation then storing the result in a std::vector<std::vector<POINT>. The bezier calculation was slowing me down so this is what I did. I start with a std::vector<USERPOINT> which is a struct with a point and 2 other points for bezier handles. I divide these ...

Making worker threads?

Is there a way to make "worker threads" Basically I tried creating threads every time I needed them and this resulted in being slower than with 1 thread becase creating a new thread all the time is expensive. Would there be a way to create worker threads when the application first starts, then give them work when necessary? Thanks ...

Change view dynamically from controller - Progress bar with threading in Rails

I have a time taking task in my controller for which I want to trigger a simple progress bar/progress status in my view. In my controller I have something like threads = [] total.times do |x| Thread.new { the_time_taking_task(x) #Something here to trigger the progressbar in the view } end threads.each { |aThrea...