interrupt

detecting interrupt on GPIO in kernel module

元气小坏坏 提交于 2019-12-10 09:46:09
问题 I am toggling the input into a GPIO line on my BeagleBone from high to low every 500 ms using an Atmel uC. I have registered a handler for this in my Linux Kernel Module, but the handler is not being called for some reason. My module code is - #define GPIO 54 #define GPIO_INT_NAME "gpio_int" #define GPIO_HIGH gpio_get_value(GPIO) #define GPIO_LOW (gpio_get_value(GPIO) == 0) short int irq_any_gpio = 0; int count =0; enum { falling, rising } type; static irqreturn_t r_irq_handler(int irq, void

Statically Defined IDT

我是研究僧i 提交于 2019-12-10 03:52:14
问题 I'm working on a project that has tight boot time requirements. The targeted architecture is an IA-32 based processor running in 32 bit protected mode. One of the areas identified that can be improved is that the current system dynamically initializes the processor's IDT (interrupt descriptor table). Since we don't have any plug-and-play devices and the system is relatively static, I want to be able to use a statically built IDT. However, this proving to be troublesome for the IA-32 arch

SQL: Interrupting a query

喜夏-厌秋 提交于 2019-12-09 16:50:05
问题 I've worked on a project using a proprietary non-SQL DB where queries could be interrupted and in the codebase there were quite some spots where that functionnality was used and made perfect sense (for example to stop a long running query that gets cancelled by the user, or when a more recent query takes place and renders the previous query obsolete, etc.) and I realized I never really saw that kind of "interrupted queries" previously and thought it could make a good SO question (several

How to kill deadlocked threads in Java?

假如想象 提交于 2019-12-09 16:26:44
问题 I'd like to kill threads that are stuck in deadlock state. First, we can detect thread ids in deadlock state using the findDeadlockedThreads() method of the ThreadMXBean class in java.lang.management . Then, I'd like to kill the threads by thread ids, and thus I have two related questions: (1) How to get the control of a thread by thread id? (2) How to kill a blocked thread? I think that invokting interrupt() method will give an exception to the thread and will kill the thread. 回答1: From the

Python Multiprocessing atexit Error “Error in atexit._run_exitfuncs”

邮差的信 提交于 2019-12-09 16:13:35
问题 I am trying to run a simple multiple processes application in Python. The main thread spawns 1 to N processes and waits until they all done processing. The processes each run an infinite loop, so they can potentially run forever without some user interruption, so I put in some code to handle a KeyboardInterrupt: #!/usr/bin/env python import sys import time from multiprocessing import Process def main(): # Set up inputs.. # Spawn processes Proc( 1).start() Proc( 2).start() class Proc ( Process

Can the R console support background tasks or interrupts (event-handling)?

自闭症网瘾萝莉.ら 提交于 2019-12-09 16:11:50
问题 While working in an R console, I'd like to set up a background task that monitors a particular connection and when an event occurs, another function (an alert) is executed. Alternatively, I can set things up so that an external function simply sends an alert to R, but this seems to be the same problem: it is necessary to set up a listener. I can do this in a dedicated process of R, but I don't know if this is feasible from within a console. Also, I'm not interested in interrupting R if it is

Interrupt processing in Windows

♀尐吖头ヾ 提交于 2019-12-09 11:21:01
问题 I want to know which threads processes device interrupts. What happens when there is a interrupt when a user mode thread is running? Also do other user threads get a chance to run when the system is processing an interrupt? Kindly suggest me some reference material describing how interrupts are handled by windows. 回答1: Device interrupts themselves are (usually) processed by whatever thread had the CPU that took the interrupt, but in a ring 0 and at a different protection level. This limits

Windows processes in kernel vs system

北慕城南 提交于 2019-12-09 10:29:23
问题 I have a few questions related to Windows processes in kernel and usermode. If I have a hello world application, and a hello world driver that exposes a new system call, foo(), I am curious about what I can and can't do once I am in kernel mode. For starters, when I write my new hello world app, I am given a new process, which means I have my own user mode VM space (lets keep it simple, 32 bit windows). So I have 2GB of space that I "own", I can poke and peek until my hearts content. However,

In a signal handler, how to know where the program is interrupted?

放肆的年华 提交于 2019-12-09 09:46:53
问题 On x86 (either 64-bit or 32-bit) Linux -- for example: void signal_handler(int) { // want to know where the program is interrupted ... } int main() { ... signal(SIGALRM, signal_handler); alarm(5); ... printf(...); <------- at this point, we trigger signal_handler ... } In signal_handler, how can we know we are interrupted at printf in main()? 回答1: Use sigaction with SA_SIGINFO set in sa_flags. Prototype code: #define _GNU_SOURCE 1 /* To pick up REG_RIP */ #include <stdio.h> #include <signal.h

Thread.Interrupt to stop long sleep at app shutdown - Is there a better approach

允我心安 提交于 2019-12-09 04:55:06
问题 I'm having a small background thread which runs for the applications lifetime - however when the application is shutdown, the thread should exit gracefully. The problem is that the thread runs some code at an interval of 15 minutes - which means it sleeps ALOT. Now in order to get it out of sleep, I toss an interrupt at it - my question is however, if there's a better approach to this, since interrupts generate ThreadInterruptedException. Here's the gist of my code (somewhat pseudo): public