interrupt

iOS AVAudioSession interruption notification not working as expected

这一生的挚爱 提交于 2019-11-29 05:35:34
I want to know when my AVAudioRecorder is inaccessible (e.g when music starts playing). As audioRecorderEndInterruption will be deprecated with iOS 9 I am focusing on AVAudioSession 's interruption notification (but neither is working as expected). The issue is that the interruption notification is never called if the app was and remains in the foreground when the interruption occurs. E.g: The user starts and stops playing music without moving the application into the background. To detect any interruptions I am using: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector

ARM Cortex M3 How do I determine the program counter value before a hard fault?

时间秒杀一切 提交于 2019-11-29 03:57:40
问题 I have an embedded project using a STM32F103 (ARM Cortex M3), it is getting a occasionally getting hard fault in release mode. As part of recovery, I would like to retrieve the PC value from before the hard fault and store it for later debugging in the battery backed region. How would I determine the value of the program counter at the point of the hard fault? Obviously, the PC is now set to its location within the hardfault interrupt. Where should I look? It there an address for the normal

When and how are system calls interrupted?

自闭症网瘾萝莉.ら 提交于 2019-11-29 02:25:49
问题 This is a followup question to Is a successful send() "atomic"?, as I think it actually concerns system calls in general, not just sends on sockets. Which system calls can be interrupted, and when they are, where is the interruption handled? I've learned about SA_RESTART, but don't exactly understand what is going on. If I make a system call without SA_RESTART, can the call be interrupted by any kind of interrupts (e.g. user input) that don't concern my application, but require the OS to

What are the differences between calling System.exit(0) and Thread.currentThread().interrupt() in the main thread of a Java program?

落爺英雄遲暮 提交于 2019-11-29 00:14:03
问题 Both cause a program to stop executing. It's clear that there must be some differences in how this happens, though. What are they? 回答1: Summary thread.interrupt() does not stop a thread. It is used for coordination in multi-threaded programs. Don't use it unless you know exactly what you do. Throwing a RuntimeException will (usually) terminate the thread but not necessarily the program. System.exit(int) almost always terminates the program and returns a status code. In unusual situations,

Android usb host: asynchronous interrupt transfer

谁都会走 提交于 2019-11-28 23:46:49
问题 I'm trying to connect a USB-Device ( build by myself ) to communicate with my development board ( ODROID-X ) Unfortunately, the examples are very little, as far as the asynchronous communication. I'd some problems with the interrupt driven data exchange - how to build the connection by using the asynchronous interrupt mode? In one direction, the transmission was possible ... but in both it doesn't work. Is there an example like this: send a ByteBuffer with endpoint_OUT get a message from

Is Thread.interrupt() evil?

可紊 提交于 2019-11-28 18:38:54
A teammate made the following claim: " Thread.interrupt() is inherently broken, and should (almost) never be used". I am trying to understand why this is the case. Is it a known best practice never to use Thread.interrupt() ? Can you provide evidence why it is broken / buggy, and should not be used for writing robust multithreaded code? Note - I am not interested in this question if it's "pretty" from a design preservative. My question is - is it buggy? Short version: Is it a known best practice never to use Thread.interrupt()? No. Can you provide evidence why it is broken / buggie, and should

dma vs interrupt-driven i/o

冷暖自知 提交于 2019-11-28 17:40:06
I'm a little unclear on differences between DMA and interrupt I/O. (Currently reading Operating Systems Concepts, 7th ed). Specifically, I'm not sure when the interrupts occur in either case, and at what points in both cases is the CPU is free to do other work. Things I've been reading, but can't necessarily reconcile: Interrupt-driven Controller initialized via driver Controller examines registers loaded by driver in order to decide action Data transfer from/to peripheral and controller's buffer ensues. Controller issues interrupt when (on each byte read? on each word read? when the buffer

Intel x86 vs x64 system call

非 Y 不嫁゛ 提交于 2019-11-28 16:00:29
问题 I'm reading about the difference in assembly between x86 and x64. On x86, the system call number is placed in eax , then int 80h is executed to generate a software interrupt. But on x64, the system call number is placed in rax , then syscall is executed. I'm told that syscall is lighter and faster than generating a software interrupt. Why it is faster on x64 than x86, and can I make a system call on x64 using int 80h ? 回答1: General part EDIT: Linux irrelevant parts removed While not totally

Polling or Interrupt based method

拥有回忆 提交于 2019-11-28 15:59:11
When should one use polling method and when should one use interrupt based method ? Are there scenarios in which both can be used ? If the event of interest is: Asynchronous Urgent Infrequent then an interrupt based handler would make sense. If the event of interest is: Synchronous (i.e. you know when to expect it within a small window) Not Urgent (i.e. a slow polling interval has no ill effects) Frequent (i.e. majority of your polling cycles create a 'hit') then polling might be a better fit. Other considerations include whether you are writing a device driver for an OS or just writing bare

How a thread should close itself in Java?

拥有回忆 提交于 2019-11-28 15:06:29
问题 This is a short question. At some point my thread understand that it should suicide. What is the best way to do it: Thread.currentThread().interrupt(); return; By the way, why in the first case we need to use currentThread ? Is Thread does not refer to the current thread? 回答1: If you want to terminate the thread , then just returning is fine. You do NOT need to call Thread.currentThread().interrupt() (it will not do anything bad though. It's just that you don't need to.) This is because