multitasking

IOS Simulator SigKill

故事扮演 提交于 2019-12-07 17:50:34
问题 I was experimenting with my app in the ios simulator when I found that it produces the SIGKILL signal when I delete it from the multitasking bar and then rerun it. (I do this by stopping the app, running another app, then deleting the first app from the multitasking bar and rerunning it.) I thought this might have something do do with my latest experiment, adding Core Data, but after trying to simplify the conditions, it looks like it is happening withe every app I test it with. The code

Understanding Async/Await pattern for multi-tasking

戏子无情 提交于 2019-12-06 16:24:22
问题 Currently, i am having difficulties to understand multi-tasking using async and await pattern. In order test a case, i have written following code to understand some basics; public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private int global_int = 10; public async Task<int> RunAsyncTask() { // This method runs asynchronously. await Task.Run(() => Calculate()); return global_int; } private int Calculate() { Console.WriteLine("Ticket count: " + --global

How to restart an app when resumes from multi-tasking

笑着哭i 提交于 2019-12-06 12:29:02
问题 So my app relies on an internet connection and every time the app is opened from the home screen it checks using Reachability and then allows the user to continue or tells them to get connected. My issue however is that when the app is resumed from multitasking, it skips the initial view controller and goes straight to where they were. Is there any way in swift that I could get the app to refresh or restart when it is resumed from multi-tasking? Thanks EDIT When using this code: let

Programmatically refresh screenshot in iOS7 multitasking screen?

不羁的心 提交于 2019-12-06 12:20:29
问题 I have a music player app which implements background audio. I’m trying to update the screenshot in the iOS7 multi-tasking switcher when the track changes. So, if I background the app during Song A, it finishes and Song B comes on, if I then go into the tray I’d like to see a screenshot showing Song B’s artwork, title, etc. I’ve done some digging and not managed to find any way to tell iOS to update short of implementing Background Fetch and going all out with that. Is there another means of

Can I cancel the method \"applicationDidEnterBackground?

自古美人都是妖i 提交于 2019-12-06 07:20:15
I wanted to cancel the method, to request a confirmation from the user when he presses the button "HOME" where on iPhone would go into the execution in background. If the user accepts, enters into the execution in background, if not accept, I do not do anything. I looked in the FORUM, in the documentation from Apple and I found nothing. Could anyone help me? Thanks in advance! No you can't override this. The event will always fire but it does give you time to clean up before you move to the background. Your delegate’s applicationDidEnterBackground: method has approximately five seconds to

How to check if thread has finished work in C++11 and above?

我只是一个虾纸丫 提交于 2019-12-06 04:16:16
问题 How can I check if thread has finished work in C++11 and above? I have been reading the documentation and I have written the following code: #include <iostream> #include <thread> void mythread() { //do some stuff } int main() { std::thread foo(mythread); if (foo.joinable()) { foo.join(); //do some next stuff } } joinable tells only that the thread has started work, but I would like to know how to write code to check if the thread has finished work. For example: #include <iostream> #include

CPU Registers and Multitasking

柔情痞子 提交于 2019-12-06 03:04:12
问题 I'm currently learning Assembly and I'm confused how the CPU registers work with Multitasking. So in a Multitasking System. CPU can pause the execution of a certain program at any time and run another program. So how are the register values preserved during this step ? Are the registers pushed to stack or any other way ? 回答1: how the CPU registers work with Multitasking. CPU basically may not work with multitasking, task switch may be (and is) implemented in software. Some CPU (intel x86) may

How to resume AVAudioPlayer after interrupted in background

橙三吉。 提交于 2019-12-05 23:33:26
问题 I am playing music using AVAudioPlayer in background. The problem is: if there is a incoming calling interrupts the player, it will never resume unless switch to foreground and do it manually. The code is simple, to play it in background: [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error: nil]; [[AVAudioSession sharedInstance] setActive: YES error: nil]; url = [[NSURL alloc] initFileURLWithPath:...]; audio_player = [[AVAudioPlayer alloc]

NSURLConnection and multitasking in iOS

浪子不回头ぞ 提交于 2019-12-05 22:16:37
问题 I'm using NSURLConnection to download resources asynchronously in iOS. (They are large-ish PDF files, so it takes some time on a slow connection.) Now I'm updating my app from iOS 3 to iOS 4. As my app is none of location-aware, voip, and background music, I guess I need to do something. My question is, then, what happens to the NSURLConnection currently running? Is it suspended and magically resumed when the app comes back to the foreground, or is it outright killed? If it is the latter,

POSIX C Threads. Mutex example. Don't work as expected

自作多情 提交于 2019-12-05 03:33:12
I have a big problem, I can't figure out why mutexes in C don't work as I expect. This is my code: #include <stdlib.h> #include <stdio.h> #include <pthread.h> pthread_t mythread; pthread_mutex_t mymutex; void *anotherFunc(void*) { pthread_mutex_lock(&mymutex); for(int i = 0; i < 100; i++) printf("anotherFunc\n"); pthread_mutex_unlock(&mymutex); pthread_exit(NULL); } void *func(void*) { pthread_mutex_lock(&mymutex); for(int i = 0; i < 100; i++) printf("func\n"); pthread_mutex_unlock(&mymutex); pthread_exit(NULL); } int main(int argc, char *argv[]) { pthread_mutex_init(&mymutex, NULL); pthread