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
3
votes
7 answers

What is the simplest way of moving some work to background thread?

Let's suppose I have this piece of code. foreach(string value in myList) { string result = TimeConsumingTask(value); //update UI listBox.Add(result); } I want to move string result = TimeConsumingTask(value); to some…
Haris Hasan
  • 29,856
  • 10
  • 92
  • 122
3
votes
3 answers

iOS4 Create Background Timer

I (Basically) need to create a background timer on iOS 4 that will allow me to execute some code when a specific amount of time has passed. I have read that you can accomplish this using some [NSThread detachNewThreadSelector: toTarget: …
Richard J. Ross III
  • 55,009
  • 24
  • 135
  • 201
3
votes
0 answers

What to use in background thread instead of MR_contextForCurrentThread

I'm working with new version of Magical Records and have a problem. Method of MR_contextForCurrentThread is deprecated, i want to find new context instead of that, but without success, i am always have error. I'm already tried simple MR_Context and…
3
votes
4 answers

ios - Can I run background thread even app is turned off

I have an application, it will make a reminder to user in specific time. Now, I want to synchronize data from server every 60 minutes (or other duration:1 day, 1 week,... in the future). It must be run even app is already turned off. I also heard a…
ryan_le
  • 69
  • 1
  • 8
2
votes
3 answers

Updating Cursor in background thread

I have a similar problem to the one described in this discussion: I need to refresh a ListView when the underlying database changes, but the query is expensive so I'm doing it in an AsyncTask. Here's what I do when the updated Cursor is ready. (This…
Graham Borland
  • 60,055
  • 21
  • 138
  • 179
2
votes
2 answers

Publish background context Core Data changes in a SwiftUI view without blocking the UI

After running a background-context core data task, Xcode displays the following purple runtime warning when the updates are published in a SwiftUI view: "[SwiftUI] Publishing changes from background threads is not allowed; make sure to publish…
jesseblake
  • 100
  • 1
  • 10
2
votes
7 answers

Run timer in background thread

Im looking for a way to use a System.Windows.Forms.Timer within a backgrounder thread. I cam having a lot of trouble getting it to start and stop within the background thread. This is what i am doing: private System.Windows.Forms.Timer chkTimer =…
Greg
  • 71
  • 1
  • 4
  • 9
2
votes
1 answer

Core Data Background Thread Returning Inserted NSManagedObject

In my app I am using a NSPersistantContainer with two NSManagedObjectContexts (viewContext & background context). All my read operations are performed on view context, while all my write operations are performed on the background context (shown…
2
votes
3 answers

Child Thread not working after main thread finishes

I'm developing an application that, listen a queue from different thread but I have a problem about thread management. I started a background thread from my main application. It is work fine but after Main application finished, then child threads…
rafet C.
  • 35
  • 1
  • 4
2
votes
1 answer

Background thread in ScanCallback

I am writing an application that contains a service that handles Bluetooth device discovery. My discovered devices are received in the ScanCallback method. I want to make sure that everything that happens inside ScanCallback is handled in the…
Saik
  • 993
  • 1
  • 16
  • 40
2
votes
1 answer

Store all the information at once using Realm in Background thread Android

I am developing an android app, where I am using Relam as local Database. I have rest api one for all the user information and other is for news information. I have two buttons. one for showing the user information and other is for showing the news…
2
votes
1 answer

NSURLSessionDataTask not called after NSURLSessionDownloadTask in the same NSURLSession in iOS background

My iOS app works in the following way I have an array of audio file names, I check whether the file is present. If it's present it starts playing it. Once finished I start playing the next audio. If the file is not present I make a…
2
votes
0 answers

Rocksdb background threads are working after deleting db instance

My start up method: vector columnFamilies = ... DBOptions dbOptions(options); std::vector ttls = ... DBWithTTL* _db; std::vector _handles; Status status = DBWithTTL::Open(dbOptions,…
Mugen
  • 8,301
  • 10
  • 62
  • 140
2
votes
0 answers

load GMSMapView in uitableviewcell in background thread

I want to load the gmsmapview in the view inside the cell. Below code works proper. But it tableview scroll is not smoth. Because of the everytime the mapview get load and it take time. Is there any other option to load mapview in background thread…
iOS developer
  • 131
  • 1
  • 1
  • 9
2
votes
2 answers

Running background thread in GAE flexible environment with Python-compact

I am working on migrating an existing python GAE (Google App Engine) standard environment app to the flexible environment. I read through the guide and decided to try out the python-compact runtime, as it's always good to re-use as much code as…
1 2
3
14 15