interrupt

How to kill deadlocked threads in Java?

陌路散爱 提交于 2019-12-04 03:43:19
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. From the root threadgroup, you can have the Thread class enumerate all running threads . Then you can call Thread

Accessing kernel driver data from FIQ interrupt handler failing

狂风中的少年 提交于 2019-12-04 03:39:16
问题 On ARM FIQ interrupts, we have some registers reserved only for FIQ use, and those are a handy way to "save the state" for example of data transfer between FIQ calls. Currently I'm triggering some GPIO pins from the FIQ, and it is working as expected. When setting up the FIQ handler, I pass the pointers to the data registers, that were mapped with ioremap. Working code looks like this: //Driver initialization: static char* dout0; static char* din0; ... static int driver_probe(struct platform

How come _exit(0) (exiting by syscall) prevents me from receiving any stdout content?

六月ゝ 毕业季﹏ 提交于 2019-12-04 03:31:55
问题 I have a Linux x86-32 GAS assembly program terminating like this: movl $1, %eax movl $0, %ebx # argument for _exit int $0x80 When I exit like this, the program functions like normally, but if I try to read the stdout output, I get nothing (using i.e. less or wc). I tried compiling a minimal C program and comparing the strace outputs. The only difference I found was, that GCC made the C program ( int main() { printf("donkey\n"); } ) implicitely exit with exit_group(0) in the strace output. I

Posting a message to a web worker while it is still running

六月ゝ 毕业季﹏ 提交于 2019-12-04 03:27:47
问题 Say we have a web worker referring to a file called "worker.js". We use the worker to execute a function in "worker.js" that does some lengthy operation. We call post the respective message to the worker and proceed in the main thread. However, before the worker has finished doing its initial work, the main thread posts another message to it. My question: Will the worker continue with our time-taking function and only process the newly posted message once finished or will it interrupt its

arm sleep mode entry and exit differences WFE, WFI

大城市里の小女人 提交于 2019-12-04 02:47:36
I am reasonably new to the ARM architectures and I am trying to wrap my head around the wake up mechanism. So first of all I am finding it difficult to find good info on this. ARM's documentation seems to be very terse on the topic. What I'd like to understand is when the Cortex (particularly the M0 as that's what I am working with) will wake up. For reference, I have also consulted the following: What is the purpose of WFI and WFE instructions and the event signals? Why does the processor enter standby when using WFE instruction but not when using WFI instruction? The docs on the WFE

Python Multiprocessing atexit Error “Error in atexit._run_exitfuncs”

大兔子大兔子 提交于 2019-12-04 02:43:51
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 ): def __init__ ( self, procNum): self.id = procNum Process.__init__(self) def run ( self ): doneWork

What does Future.cancel() do if not interrupting?

好久不见. 提交于 2019-12-03 22:54:29
From java docs on Future.cancel() boolean cancel(boolean mayInterruptIfRunning) Attempts to cancel execution of this task. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel is called, this task should never run. If the task has already started, then the mayInterruptIfRunning parameter determines whether the thread executing this task should be interrupted in an attempt to stop the task. My question is what does cancel do if mayInterruptIfRunning is false

c - interrupt a function call which is executing in a thread

五迷三道 提交于 2019-12-03 21:35:59
I have a DLL which contains a thread function whose pseudocode looks like: volatile BOOL stopped = FALSE; void StopEverything() { /* Enter critical section */ stopped = TRUE; /* Leave critical section */ } void workerThreadFunc() { Initialize(); /* Checkpoint 1 */ if(stopped) { /* Do cleanup */ return; } doLaboriousTask1(); /* Checkpoint 2 */ if(stopped) { /* Do cleanup */ return; } doLaboriousTask2(); Uninitialize(); } And in the code which uses this DLL, the cleanup function looks like: void cleanup() { StopEverything(); /* Wait for all threads to exit */ /* Do other cleanup */ } My question

How an I2c read as well as write operation in “handler function” of request_threaded_irq affects the driver as a whole.?

做~自己de王妃 提交于 2019-12-03 20:22:39
I have a driver code with handler function and thread function of request_threaded_irq similar to this: irq-handler fn() { /*disable device interrupt*/ i2c read from register; set disable bit to client-device-interrupt i2c write back; return IRQ_WAKe_THREAD; } irq-thread fn() { i2c read from register; .... .... /*enable device interrupt*/ i2c read from register; set enable bit to client-device-interrupt i2c write back; /*Rest of the operation*/ .......... .......... return IRQ_HANDLED; } I have few question with respect to above implentation. Will 2 i2c operation in "handler fn" takes

Real time linux : disable local timer interrupts

和自甴很熟 提交于 2019-12-03 16:30:38
TL;DR : Using linux kernel real time with NO_HZ_FULL I need to isolate a process in order to have deterministic results but /proc/interrupts tell me there is still local timer interrupts (among other). How to disable it? Long version : I want to make sure my program is not being interrupt so I try to use a real time linux kernel. I'm using the real time version of arch linux (linux-rt on AUR) and I modified the configuration of the kernel to selection the following options : CONFIG_NO_HZ_FULL=y CONFIG_NO_HZ_FULL_ALL=y CONFIG_RCU_NOCB_CPU=y CONFIG_RCU_NOCB_CPU_ALL=y then I reboot my computer to