Polling or Interrupt based method

前端 未结 14 2571
暗喜
暗喜 2020-12-12 13:44

When should one use polling method and when should one use interrupt based method ? Are there scenarios in which both can be used ?

14条回答
  •  情书的邮戳
    2020-12-12 14:16

    Always use a interrupt. That way you never lose data. In event driven or threaded applications even the slowest signals should be interrupt driven.

    The only time that you should use polling is when you are using a scheduler and the buffers on your hardware are deep enough to ensure no data loss.

提交回复
热议问题