【问题标题】:node.js: fixing ev_ref/ev_unref warningnode.js:修复 ev_ref/ev_unref 警告
【发布时间】:2012-08-24 05:37:23
【问题描述】:

我有一个 Node.JS extension 在 Node.JS 0.8.4 中引起警告:

WARNING: ev_ref is deprecated, use uv_ref
WARNING: ev_unref is deprecated, use uv_unref

我想修补扩展以避免这些警告,但我找不到有关 ev_ref/uv_ref 的任何信息。

警告可能是由以下行引起的:

  ev_ref(EV_DEFAULT_UC);
  ev_unref(EV_DEFAULT_UC);

(未找到其他变体)。

什么是等效的 uv_[un]ref() 调用,是否有任何我应该知道的兼容性问题?

【问题讨论】:

  • 据我所知,ev_ref() 为 javascript 线程提供了一个参考点,下面是对 EV_DEFAULT_UC 的一点解释:pastebin.com/wwsWTsNC,尽管我不确定这是否有帮助。
  • 您需要使用uv_ref((uv_handle_t *)some_handle);,其中some_handle 是观察者。这里有一些文档:nikhilm.github.com/uvbook/basics.html#watchers

标签: node.js


【解决方案1】:

有关如何使用 uv_ref() 和 uv_unref() 的示例,请参阅 this commit to node-geos。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-29
    • 2017-05-31
    • 1970-01-01
    • 2019-12-07
    • 2019-10-21
    • 2019-08-08
    • 2020-11-28
    • 2017-10-25
    相关资源
    最近更新 更多