tinyos中的事件是否在堆栈内发出信号?

时间:2022-02-25 19:11:14

I wanted to ask something that I think is not clearly specified in the tinyos2 programming manual. When a command or task signals an interface event are the wired functions called immediately, i.e. in the same callstack, or are these signaled events "posted" for later execution?

我想问一下我认为在tinyos2编程手册中没有明确规定的内容。当命令或任务发出信号时,接口事件是立即调用的有线函数,即在同一个调用堆栈中,或者这些信号事件被“发布”以供以后执行?

I tend to believe it's the former one, but just to clarify it.

我倾向于认为它是前者,但只是为了澄清它。

2 个解决方案

#1


TinyOS 1 or 2 does not make a difference here - this is a nesC question. Upon signal, execution begins immediately. However, if multiple components are wired to an interface, execution is done one after another (aka. fan-out).

TinyOS 1或2在这里没有什么区别 - 这是一个nesC问题。发出信号后,立即开始执行。但是,如果将多个组件连接到接口,则会一个接一个地执行(也就是扇出)。

#2


I only know TinyOS v1, but I believe they are the same in this regards.

我只知道TinyOS v1,但我相信它们在这方面是一样的。

Events are just function calls, and so execute on the same stack as the caller.

事件只是函数调用,因此在与调用者相同的堆栈上执行。

If something needs to be posted for later execution, it should be implemented as a task. So, event consumers that need to do long-running work in response to an event but don't want to interfere with interrupt latency should schedule a task, and that task should do a little bit of the work and then schedule a task to do more of the work in the same way.

如果需要发布某些内容以供以后执行,则应将其作为任务实现。因此,需要长时间运行以响应事件但不想干扰中断延迟的事件使用者应安排任务,并且该任务应该执行一些工作,然后安排任务执行更多的工作以同样的方式。

#1


TinyOS 1 or 2 does not make a difference here - this is a nesC question. Upon signal, execution begins immediately. However, if multiple components are wired to an interface, execution is done one after another (aka. fan-out).

TinyOS 1或2在这里没有什么区别 - 这是一个nesC问题。发出信号后,立即开始执行。但是,如果将多个组件连接到接口,则会一个接一个地执行(也就是扇出)。

#2


I only know TinyOS v1, but I believe they are the same in this regards.

我只知道TinyOS v1,但我相信它们在这方面是一样的。

Events are just function calls, and so execute on the same stack as the caller.

事件只是函数调用,因此在与调用者相同的堆栈上执行。

If something needs to be posted for later execution, it should be implemented as a task. So, event consumers that need to do long-running work in response to an event but don't want to interfere with interrupt latency should schedule a task, and that task should do a little bit of the work and then schedule a task to do more of the work in the same way.

如果需要发布某些内容以供以后执行,则应将其作为任务实现。因此,需要长时间运行以响应事件但不想干扰中断延迟的事件使用者应安排任务,并且该任务应该执行一些工作,然后安排任务执行更多的工作以同样的方式。