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

Running expensive grid calculations in the background - Objective-C

I have an NSMutableArray that's accessed primarily by the main thread in my iOS game. Every 2-3 seconds I need to perform an expensive operation on this grid. I don't need to modify the grid. I just need to do some calculations and return a result.…
SundayMonday
  • 19,147
  • 29
  • 100
  • 154
0
votes
3 answers

Android NonUI Thread making application "not respond"

I am editing the code of an android app that is making GPS calls in a service. LocationListener. It also uses ServiceConnection In some views the device decides that my application is taking too long to respond, and that the user can either "Force…
CQM
  • 42,592
  • 75
  • 224
  • 366
-1
votes
1 answer

.NET 6.0 PeriodicTimer in Background Thread 300% cpu

var timer = new PeriodicTimer(TimeSpan.FromMinutes(5)); new Thread(async () => { try { while (await timer.WaitForNextTickAsync().ConfigureAwait(false)) { ... do some…
andrey1567
  • 97
  • 1
  • 13
-1
votes
1 answer

How do I use AsyncTask' s onPostExecute method to uptate a variable in Android

I'm trying to update a variable after running a background task with AsyncTask to the result of the background task. The variable updates, but not on time apparently. The toast I use to display the server response displays an empty toast at first…
-1
votes
3 answers

Loading UI on a different thread in Swift

I have a child controller that have a complicated UI views. My View is designed in storyboard. That causes the screen to freeze and it increases the chance of crashing if user kept tapping on the freezed screen. Is it possible that I load the UI in…
hasan
  • 23,815
  • 10
  • 63
  • 101
-1
votes
1 answer

ios long running task in background task

In ios, it supports long running background task for certain types of apps with background modes such as App registers for location updates,App provides Voice over IP services,App plays audio,App processes Newsstand Kit downloads,App communicates…
gReEn HoRn
  • 274
  • 1
  • 4
  • 19
-2
votes
1 answer

Cancel a task that running on thread in ASP.NET MVC using C#

How do i run this task in background and my other web stuff (Server API's) should work? and also cancelable on any point. Because my server is capable of run heavy operations and multi thread. C# [HttpPost] [AsyncTimeout(30 * 60 *…
-2
votes
3 answers

Main Thread Checker: UI API called on a background thread: -[UIApplication delegate] Freezes the application

Whenever my application fetch data from JSON it sometimes get this warning and application freezes right away: Main Thread Checker: UI API called on a background thread: -[UIApplication delegate] PID: 7439, TID: 362794, Thread name: (none), Queue…
shahtaj khalid
  • 476
  • 7
  • 24
-2
votes
1 answer

Android Studio: Creating a progress bar that will lead to next activity at 100%

How does one create a progress bar that will allow the application to jump from one activity to the next upon being completed? (bar filled to 100%) From the Android Developers site, I retrieved the following example code, but I'm not sure where/how…
-2
votes
1 answer

Waiting for a background thread to complete before function return

I try to create function that return Internet status as Bool: func isConnectedToNetwork()->Bool{ var InternetStatus = Bool() RealReachability.sharedInstance().reachabilityWithBlock { (status:ReachabilityStatus) in switch status { …
Dmitry
  • 2,963
  • 2
  • 21
  • 39
-2
votes
3 answers

How to confirm that a method will execute under main thread in objective C?

I have a method say someMethod(), I always want this method should be executed under main thread. So I wrote this method like this.. -(void)someMethod { if([NSThread mainThread]) { // Do method stuffs } else { [self…
Confused
  • 3,846
  • 7
  • 45
  • 72
-2
votes
2 answers

How to update PictureBox from BackgroundThread?

I'm doing all my expensive calculations in a background thread and need to be able to assign pictureBox1.Image after each cycle of calculations. I use to do this using delegates, but its been a long time and things don't seem to work that way…
-3
votes
2 answers

Run Thread Until 2 Integers are the Same

I want to check in the background if 2 Integers are the same. When they are the same I want the thread to stop and I want one of my function to be called. How can I do this?
-4
votes
1 answer

How to run thread in Main with DispatchTime in for Loop swift

I have doubt for the run thread with time delay Dispatch is not enter to after finished the time? for i in 0...10000 { let deadLine = DispatchTime.now() + .milliseconds(1000) DispatchQueue.main.asyncAfter(deadline: deadLine) { …
1 2 3
14
15