问题
As I was going through the Interrupt Handling in Linux, I had this question if we can make reference to the current macro pointing to the interrupted task, while the core is in hard-irq mode? Also, if this referencing is possible whatwill happen if we make a call to semaphore "down", though this is highly discouraged.?
回答1:
I believe it's possible to do, at least on x86, in the sense that it won't cause an immediate panic.
It is however ALWAYS wrong to do this. An interrupt is not associated with any task, there's no link between the interrupt and a certain task running, so there's no sensible reason to try to do this anyway. What good it the current task if it could be any task on the system?
来源:https://stackoverflow.com/questions/10646892/reference-to-current-task-in-linux-interrupt-context