浏览代码

Fix code reloading for Jiffy

As it turns out I did not understand the documenation for
load/upgrade/unload correctly. load/upgrade are called conditionally if
there's code in the VM for the NIF. Ie, no code means load is called,
where as if code exists, upgrade is called.

unload is called regardless once per load/unload. This means that
load/upgrade in Jiffy's case will each create a state object and unload
will free it each time. I was missing the fact that unload is called
every time and hence I don't need to clear the state in upgrade.
pull/29/head 0.5.2
Paul J. Davis 13 年前
父节点
当前提交
f71616198f
共有 1 个文件被更改,包括 0 次插入2 次删除
  1. +0
    -2
      c_src/jiffy.c

+ 0
- 2
c_src/jiffy.c 查看文件

@ -42,8 +42,6 @@ reload(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
static int static int
upgrade(ErlNifEnv* env, void** priv, void** old_priv, ERL_NIF_TERM info) upgrade(ErlNifEnv* env, void** priv, void** old_priv, ERL_NIF_TERM info)
{ {
if(*old_priv != NULL)
enif_free(*old_priv);
return load(env, priv, info); return load(env, priv, info);
} }

正在加载...
取消
保存