【修改】多个线程在修改同一个message时可能出现的问题
This commit is contained in:
@@ -489,6 +489,9 @@ int lua_mq_update_topic(lua_State *state)
|
|||||||
luaL_unref(state, LUA_REGISTRYINDEX, private_ref);
|
luaL_unref(state, LUA_REGISTRYINDEX, private_ref);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifdef LUAPLUGIN_BASIC_UNITTEST
|
||||||
|
LOGDEBUG("update topic, id %d %d %d", topic_id, private_ref, free_ref);
|
||||||
|
#endif
|
||||||
|
|
||||||
mq->freemessage_ref = free_ref;
|
mq->freemessage_ref = free_ref;
|
||||||
mq->mq_private_ref = private_ref;
|
mq->mq_private_ref = private_ref;
|
||||||
@@ -503,12 +506,15 @@ int lua_mq_update_topic(lua_State *state)
|
|||||||
lua_rawgeti(state, LUA_REGISTRYINDEX, private_ref);
|
lua_rawgeti(state, LUA_REGISTRYINDEX, private_ref);
|
||||||
lua_pushlightuserdata(state, (void *)mq); /* stack top new_mq */
|
lua_pushlightuserdata(state, (void *)mq); /* stack top new_mq */
|
||||||
lua_setfield(state, -2, LUA_MQ_ENV_DEFAULT_KEY); /* stack top table */
|
lua_setfield(state, -2, LUA_MQ_ENV_DEFAULT_KEY); /* stack top table */
|
||||||
luaL_unref(state, LUA_REGISTRYINDEX, mq->mq_private_ref);
|
// luaL_unref(state, LUA_REGISTRYINDEX, mq->mq_private_ref);
|
||||||
mq->mq_private_ref = private_ref;
|
mq->mq_private_ref = private_ref;
|
||||||
|
|
||||||
/* 更新free function ref */
|
/* 更新free function ref */
|
||||||
luaL_unref(state, LUA_REGISTRYINDEX, mq->freemessage_ref);
|
// luaL_unref(state, LUA_REGISTRYINDEX, mq->freemessage_ref);
|
||||||
mq->freemessage_ref = free_ref;
|
mq->freemessage_ref = free_ref;
|
||||||
|
|
||||||
|
#ifdef LUAPLUGIN_BASIC_UNITTEST
|
||||||
|
LOGDEBUG("update topic, id %d %d %d", topic_id, private_ref, free_ref);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_settop(state, 0);
|
lua_settop(state, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user