multitasking

Lua: preemtive (not cooperative) multitasking in Lua with thread-like structures

左心房为你撑大大i 提交于 2020-01-14 19:38:32
问题 I was wondering whether Lua has any preemptive multitasking facilities built-in. I would like to have concurrent threads to use on my multi-core system. I looked into coroutines (see lua-users.org/wiki/CoroutinesTutorial and stackoverflow.com/questions/3107165/there-is-a-type-named-thread-in-lua-does-anyone-know-something-of-this), but it seems not to fit the bill. I wrote the following code: function foo(ver) local iter = 1; while true do print("foo ver="..ver.." iter="..iter); iter = iter +

How to get a PERMANENT application notifier in the status bar?

旧时模样 提交于 2020-01-12 03:37:26
问题 I searched on the Internet alot but cant find a proper answer to this. I have used apps like 3G watchdog and Advanced task killer on my android phone. I noticed that they always have an icon up when the status bar is minimized and also have a notification( Upon clicking opens the app) which cant be cleared from the status bar. I like to use something like this in my app. I know how to get an image and everything in the status bar, but how to keep one that cant be cleared till my app is

How to use AVCaptureSession with Slide Over and Split View in iOS 9?

早过忘川 提交于 2020-01-11 15:49:06
问题 My team is developing a set of SDKs for barcode scanning, ID scanning and OCR. We use device's camera, specifically, AVCaptureSession , to obtain video frames on which we perform our processing. We're exploring new iOS 9 multitasking features Slide Over and Split View. Apple suggests opting out of these features for camera-centric apps, where using the entire screen for preview and capturing a moment quickly is a primary feature (reference). This is the approach the use in their sample app

How to use AVCaptureSession with Slide Over and Split View in iOS 9?

邮差的信 提交于 2020-01-11 15:48:21
问题 My team is developing a set of SDKs for barcode scanning, ID scanning and OCR. We use device's camera, specifically, AVCaptureSession , to obtain video frames on which we perform our processing. We're exploring new iOS 9 multitasking features Slide Over and Split View. Apple suggests opting out of these features for camera-centric apps, where using the entire screen for preview and capturing a moment quickly is a primary feature (reference). This is the approach the use in their sample app

UILocalNotification in sleep mode on iPhone

╄→гoц情女王★ 提交于 2020-01-11 11:28:26
问题 I'm developing a Voip application. When I press the lock button(app goes to sleep), and the server sends a request I present a local notification. The local notification is presented as it should and The button slider text says "slide to answer". If I slide here, the app gets open. However, if now I press again the lock button, and then unlock, the notification is still presented and the slider text has changed to "slide to unlock". Now, when I slide to unlock, it's as if I pressed the "close

Inheritance threading.Thread class does not work

元气小坏坏 提交于 2020-01-11 04:00:09
问题 I'm new in multithreading, so the answer is probably very simple. I'm trying to make two instances of one class and run them parallel. I've read that I can use class inheritance to do that. class hello(threading.Thread): def __init__(self,min,max): threading.Thread.__init__(self) time.sleep(max) for i in range(1000): print random.choice(range(min,max)) h = hello(3,5) k = hello(0,3) I've noticed that this does not work (the first outputs are numbers between 3 and 5) Could you explain what am I

The exact moment iOS takes the view snapshot when entering background?

假如想象 提交于 2020-01-09 12:51:11
问题 I have a problem when putting my iPhone app to background by pushing the exit button, and then relaunching by tapping the launch icon on the home screen: the app's view does return to its initial state like I want it to, but before that it flashes the earlier, wrong view state onscreen briefly. Background My main view consists basically of a sequence of interlinked UIAnimateWithDuration calls. The behavior I want whenever any interruption occurs, is to reset the animation to its initial state

Do not resume MPMoviePlayerController when application enters foreground

对着背影说爱祢 提交于 2020-01-05 05:02:25
问题 I am developing an iPhone application which plays the video using MPMoviePlayerController . When I switch to background(device with multi-tasking support), the video play is paused and when I bring my app to foreground video play is resumed. But, when I switch to foreground I do not want my video to be resumed. I tried to pause the MPMoviePlayerController in the method applicationWillEnterForeground. But, I think they resume implicitely after call to applicationWillEnterForeground . Is there

GUI is stuck with uibackgroundmodes= voip, audio

℡╲_俬逩灬. 提交于 2020-01-04 04:13:05
问题 I have tabbar-based application. When I put in my plist UIBackgroundModes (my application is supposed to support voip), the GUI doesn't load. It sucks on Splash screen and doesn't load the first tab view. When i remove the UIBackgroundModes property from info.plist, it works fine. More than that, pressing the home button when it stuck does nothing. Did somebody encountered a similar problem? (The problem exists on simulator) Thanks, Nava 回答1: It appears, that the problem happens on Simulator

iOS - Concurrent access to memory resources

喜夏-厌秋 提交于 2020-01-03 12:32:13
问题 My app downloads several resources from server, data and data descriptors. These downloads, triggered by user actions, can be performed simultaneously, let's say, up to 50 downloads at a time. All these asynchronous tasks end up creating objects in memory, (e.g. appending leaves to data structures, such as adding keys to mutable dictionaries or objects to arrays). My question is: can this cause stability issues? For instance, if several simultaneous tasks try to add keys to the same