SerialThingHandler.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:openhab2-addons 作者:
@Override
public void serialEvent(SerialPortEvent arg0) {
    try {
        /*
         * The short select() timeout in the native code of the nrjavaserial lib does cause a high CPU load, despite
         * the fix published (see https://github.com/NeuronRobotics/nrjavaserial/issues/22). A workaround for this
         * problem is to (1) put the Thread initiated by the nrjavaserial library to sleep forever, so that the
         * number of calls to the select() function gets minimized, and (2) implement a Threaded streamreader
         * directly in java
         */
        logger.trace("RXTX library CPU load workaround, sleep forever");
        Thread.sleep(Long.MAX_VALUE);
    } catch (InterruptedException e) {
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号