Questions tagged [background-thread]

A background thread is a thread that not directly driving the application but does some processing asynchronously.

Many UI toolkits require the use of background threads for anything that takes longer than a couple of milliseconds in order to keep the UI responsive.

Background threads are referred to as daemon threads at times.

Often background threads take care of recurring tasks, like cleaning up caches or similar.

Since the term 'background thread' is not very specific you might want to consider more specific tags related to the actual technology you are using.

If your question is independent of the actual technology this tag is a good fit.

Background Thread in .Net
Background thread in java

224 questions
0
votes
1 answer

UI freezes in iOS when I make an async call to a WebView using CocoonJS

I developed a game using ImpactJS and I'm using CocoonJS to run it on Android and iOS. My game needs to execute some AI code, and it takes too long, so I use a WebView for executing the code in a background thread (using CocoonJS forwardAsync…
Sergio Viudes
  • 2,714
  • 5
  • 26
  • 44
0
votes
2 answers

ios: how run location manager in background

I want to run all that i do in my function : - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { } in the background. I have my page with many elements and i…
0
votes
1 answer

POSIX callback to main thread

I am an iOS programmer who is currently using Cocos2d-X to create an Android-iOS app. I would like to run a function in a background thread (unzipping a file, takes 2-3 seconds), and when it is ready I would like to have a callback to the main…
SPQR3
  • 647
  • 7
  • 20
0
votes
4 answers

change android UI according to a background thread results

I'm developing an android app that requires to make UI changes according to a background thread processing results, I tried the following code at first: Thread run_time = new Thread (){ public void run(){ …
0
votes
1 answer

Singleton DataStore on Background Thread

I have created a singleton class that accesses a datastore and returns an object representing a Core Data entity. This is fine in the normal thread but I am concerned about accessing this singleton method from another class running on a background…
0
votes
2 answers

How to run the background thread only once using ScheduledExecutors?

Below is my Interface - public interface IClient { public String read(ClientInput input); } This is my Implementation of the Interface - public class TempClient implements IClient { @Override public String read(ClientInput input) { …
user2467545
0
votes
1 answer

beginBackgroundTaskWithExpirationHandler with a current thread

beginBackgroundTaskWithExpirationHandler creates a new thread when we execute something. Can I execute something using an existing thread with this? Because new thread generated by beginBackgroundTaskWithExpirationHandler causes some problems to…
deltaaruna
  • 528
  • 6
  • 24
0
votes
3 answers

Delete Core Data object and save in background thread

I still have difficulties to understand how core data works in background thread even after having read lots of things about it, especially for deleting objects. As an example, if I want to delete an object from a context like this : -…
jcr
  • 303
  • 1
  • 6
  • 16
0
votes
2 answers

can we change a background thread operation to main thread?

How can i perform a JSON parsing in background thread in viewDidLoad and move it to main thread when clicks on a button. Now i tried [self performSelectorInBackground:@selector(parseData) withObject:nil]; -(void)parseData { MSJsonParser…
manujmv
  • 6,450
  • 1
  • 22
  • 35
0
votes
1 answer

How to make sure that I am calling a certain method only whenever there is any change in the database?

What's the best way to accomplish this problem? I want to call a particular method for the first time when I am running my application but second time it should be called only whenever there is any change. If there is no change then I don't want to…
AKIWEB
  • 19,008
  • 67
  • 180
  • 294
0
votes
2 answers

How to pause Android Background Runnable Thread?

I have a method that is throwing an InvocationTargetException every single time right after onPause is called. Its happening on the line of "long totalDuration = mp.getDuration();" How do I go about stopping this exception? /** * Background…
clever_trevor
  • 1,530
  • 2
  • 22
  • 42
0
votes
4 answers

Progressbar update from background thread

The following is my background worker thread private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { Thread t1 = new Thread(Thread1); t1.Start(); Thread t2 = new…
user2546342
  • 61
  • 2
  • 6
0
votes
0 answers

Background Thread And Foreground Thread

I have an monitoring application that will have multiple threads constantly monitoring the CPU usage, memory usage, hard disk usage, etc. I create a separate thread to monitor each of this and it keeps on running under the while loop get the values…
Dharmesh Tailor
  • 320
  • 1
  • 11
0
votes
1 answer

Issues with threading, blocks, CGImageRef and scope

I have a program where I set up a completion block that is running on a background thread. Inside the block I set up a CGImageRef and then on the main thread set my layer contents. THe problem is, sometimes the app crashes on the main thread…
0
votes
1 answer

Return Background Task Result To UI Thread defined in different different java files

Hi I have created a sample android project to learn how android can access the network task in background thread and how it will update UI thread. I have successfully done it in MainActivity.java here is my code for MainActivity.java package…