Questions for multithreading


Using Thread with paint java

I'm developing a checkers game in Java, and I stumbled on a problem.

How to set a relationship from one NSManageObject to another in a different NSManagedObjectContext

Because my app is multi-threaded I use two NSManagedObjectContexts. The main context, that runs in the main thread and another context that only runs in a separate thread.

endBackgroundTask without the background identifier

I'm using a library which is closed source that is starting a background task and I don't have the background task identifier...

Android: AsyncTask how to use wait/notify

Is it possible to call wait & notify inside an AsyncTask? So far, I tried to use them but all it does to block the AsyncTask forever. How can I overcome this? My usage is: I have a camera frame

setting up matlab multicore computing

I'm trying to use something like this in matlab

mutual exclusion using Hashtable of java

hi mate i have a global Hashtable in my class, and two thread A and B that work with her.

How I can use threads to generate terrain based on camera position without bursts of lag?

Here's the deal. My game generates chunks of randomly generated terrain based on the position of the camera (2D isometric). When moving from chunk to chunk, there is always a tiny burst of lag which

Is there a way to set thread priority in Glib v2.32+?

Glib 2.30 API allows setting thread priority via GThreadPriority enum. However, that API is deprecated as of 2.32 and I can't find any info on setting thread priorities using the new API. I've Ctrl...

Show progress bar when Entity Framework transfer data

I have a project that uses data from Entity Framework and present them in WPF. I want show threaded progress bar when Entity Framework load/save data on presentation layer.

NSThread issue with an iPhone Application

I have a rather complex application at which uses Rtmpdump and Ffmpeg libraries to download and convert Flash streams. I would like the thread

Monitoring C# Threads - Which does what/when

As everybody, I am used to debugging my code in VS in step-by-step mode. Well, now that I have an application with many Background Workers everywhere, I am not in Kansas anymore.

How to Terminate loop/thread

Here is part of my program. Loop in findDuplicates starts in background thread after button was pressed. Is there any way to stop/kill thread/loop by pressing another button?

Threading and Incrementing

So I think this might be a fundamental flaw in my approach to threading and incrementing a global counter, but here is my problem. I have a collection of file names from a DB that I iterate through...

Gracefully ending a thread that's waiting on a blocking queue

I'm having an issue with a multi-threaded server I'm building as an academic exercise, more specifically with getting a connection to close down gracefully.

How to access a given Java thread

Basically, I want to be able to run multiple threads - these threads will use sleep commands for a given period. I want to be able to manipulate the duration of these sleep threads based on user in...

Why main thread waits for another thread to finish before proceed?

The problem that I am facing in a complex Java application boils down to following: the main thread does not proceeds until the sub-thread is not finished, although I thought that it should. The code

java.util.Timer or a While loop in a SwingWorker thread?

In another question I posted recently I was suggested to use a java.util.Timer in the SwingWorker instead of a while loop. The tasks in the SwingWorker are supposed to run every 10 seconds.

Show progress text while logging user in - Android App

I'm working on an Android app and am having trouble updating the GUI. Basically what I want to achieve is when my user clicks the Sign In button, call the setVisibility method on the groupLogInPro...

Setting Local Notifications on a new thread?

I need to know if it is possible to create a new thread to handle setting local notifications.

How to allocate from heap with the correct memory alignment for InterlockedIncrement function?

This code seems to work, but have I used the InterlockedIncrement function correctly? The correct memory alignment of m_count is of my primary concern. Assume we're on a x86-64 system and compile a

Multi-threaded Mergesort problems

I'm trying to write a multi-threaded mergesort, and I'm having what to me are very confusing issues. I'm not fully aware of the rules of how threads share/use variables...

How to use the threads from a thread pool for every httprequest in java?

I need to create a thread pool of a fixed size and use the thread for every http request. Can anyone specify how to do this?

How to write a simple thread-safe class using a volatile variable?

I want to write a simple thread-safe class that could be used to set or get an Integer value.

Keeping webservice alive if a spawned thread is still working

I have a webservice that will be called by a nightly job process documents, each document will be queued and executed on it's own background processor. This process can take a couple hours or a few

How to send a subprocess to the background & without using shell=True

I'm trying to write a part of a Python script what changes the root MySQL password under Linux for a small web-admin interface. I've followed the official MySQL documentation on changing the root

using dispatch_sync as a mutex lock

Here is what I need to do.

Using a semaphore instead of while loop. Is this good or bad?

I have a process that runs in it's own thread and can be started/stopped without blocking. This will eventually go into a Windows service, but I am setting this up in a console app for now until i...

Ruby - Why Thread doesn't respect method put?

The following code throw messages without putting them with line break.

How to implement a singleton .NET component, for use by multiple processes?

I would like to implement a component in .NET, and consume it in COM-aware clients via COM interop.

Background tasks fragments and “Can not perfom this action after onSaveInstanceState”

I have the following AsyncTask in a Fragment (the example is simplified for showing clearly the error):

Avoid connection timeout when using multiple threads and connection pool

I'm splitting up a readonly database operation into multiple chunks, (Each of which reads a subset of a very large amount of data, analyzes it and writes the results to a disk file).

Is 16 milliseconds an unusually long length of time for an unblocked thread running on Windows to be waiting for execution?

Recently I was doing some deep timing checks on a DirectShow application I have in Delphi 6, using the DSPACK components. As part of my diagnostics, I created a Critical Section class that adds a

How can class method access be safely controlled in a C++ mutli threaded program using boost?

I want to translate some Java code into C++. One of the Java classes extends the Thread class and contains the following method:

How I can put a lock around InputStream and release when reading is done

I want to put a Lock around Object and lock this stream. And when I am done finished reading I want to release the lock. How can I achieve this?

MapReduce - Anything else except word-counting?

I have been looking at MapReduce and reading through various papers about it and applications of it, but, to me, it seems that MapReduce is only suitable for a very narrow class of scenarios that

Forcing threads in a service to wait for another thread to finish

I'm writing a service that has five different methods that can take between 5 seconds and 5 minutes to run.

Threads state after the program finishes execution

What happens to internal threads after the main thread finishes execution?

Threadsafe UITableView

I'm using a UITableView to show some data from an array. This array can be changed at any time by other threads. (I believe that whether the array is mutable, or just replaced entirely, doesn't mak...

What is the main thread in GCD?

What exactly is the main thread in Grand Central Dispatch? Is it a thread created when the program starts up (maybe just before the main() function gets called), which is arbitrarily called "the main

UNIX threads - about sleep and how to make a thread work for certain time?

In UNIX, if a thread calls sleep function, will the entire process not do any work for that time or only the sleep calling thread will not do any work for that time?

JApplet display

I am not sure what is wrong with my program. I think it might be a problem with threads, even though I am not creating Threads. What I have is three different classes to implement the game Minesw...

Template function will not compile when called as a thread

I have a problem relating to template functions and threads:

client number in a java multithread server

I use two classes in my server

Expose a cancellable Task

I'm designing an API that exposes a cancellable Task, and want to make sure I have designed it correctly. Is there a standard pattern for exposing Tasks (maybe something similar to the APM

Custom events in C# specifically is the sender object thread safe

Ok so I am working on implementing a set of custom events. They will primarially be used withing a multi-threaded environment to communicate major accomplishments throughout the threads. Now I have...

SignalAndWait for lock-context

I have a manager class that produces tasks for a threadpool, and each thread is supposed to do a call back once they are finished.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.