当前位置: 首页>>代码示例>>C++>>正文


C++ setthvalue函数代码示例

本文整理汇总了C++中setthvalue函数的典型用法代码示例。如果您正苦于以下问题:C++ setthvalue函数的具体用法?C++ setthvalue怎么用?C++ setthvalue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setthvalue函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: G

LUA_API lua_State *lua_newthread (lua_State *L) {
  global_State *g = G(L);
  lua_State *L1;
  lua_lock(L);
  luaC_checkGC(L);
  /* create new thread */
  L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l;
  L1->marked = luaC_white(g);
  L1->tt = LUA_TTHREAD;
  /* link it on list 'allgc' */
  L1->next = g->allgc;
  g->allgc = obj2gco(L1);
  /* anchor it on L stack */
  setthvalue(L, L->top, L1);
  api_incr_top(L);
  preinit_thread(L1, g);
  L1->hookmask = L->hookmask;
  L1->basehookcount = L->basehookcount;
  L1->hook = L->hook;
  resethookcount(L1);
  /* initialize L1 extra space */
  memcpy(lua_getextraspace(L1), lua_getextraspace(g->mainthread),
         LUA_EXTRASPACE);
  luai_userstatethread(L, L1);
  stack_init(L1, L);  /* init stack */
  lua_unlock(L);
  return L1;
}
开发者ID:duchuan123,项目名称:ravi,代码行数:28,代码来源:lstate.c

示例2: lua_pushthread

LUA_API int lua_pushthread (lua_State *L) {
  lua_lock(L);
  setthvalue(L, L->top, L);
  api_incr_top(L);
  lua_unlock(L);
  return (G(L)->mainthread == L);
}
开发者ID:AdunSG,项目名称:Pktgen-DPDK,代码行数:7,代码来源:lapi.c

示例3: LUA_pushthread

LUA_API int LUA_pushthread (LUA_State *L) {
  LUA_lock(L);
  setthvalue(L, L->top, L);
  api_incr_top(L);
  LUA_unlock(L);
  return (G(L)->mainthread == L);
}
开发者ID:mniip,项目名称:LUA,代码行数:7,代码来源:Lapi.c

示例4: lua_lock

/* weet:
 * 创建一个新的Lua协程
 * */
LUA_API lua_State *lua_newthread (lua_State *L) {
  lua_State *L1;
  lua_lock(L);
  luaC_checkGC(L);
  L1 = luaE_newthread(L);
  setthvalue(L->top, L1);
  api_incr_top(L);
  lua_unlock(L);
  lua_userstateopen(L1); // weet: 一个空的宏
  return L1;
}
开发者ID:TheWaWaR,项目名称:my-lua5.0,代码行数:14,代码来源:lapi.c

示例5: lua_newthread

LuaObject LuaState::CreateThread(LuaState* parentState)
{
    lua_State* L1 = lua_newthread(parentState->GetCState());
    lua_TValue tobject;
    setnilvalue2n(L1, &tobject);
    setthvalue(parentState->GetCState(), &tobject, L1);

	LuaObject retObj = LuaObject((LuaState*)lua_getstateuserdata(L1), &tobject);
    setnilvalue(&tobject);
    lua_pop(parentState->GetCState(), 1);
    return retObj;
}
开发者ID:korman,项目名称:Temp,代码行数:12,代码来源:LuaPlus_Libs.cpp

示例6: ktap_init_registry

static void ktap_init_registry(ktap_state *ks)
{
	ktap_value mt;
	ktap_table *registry = kp_table_new(ks);

	sethvalue(&G(ks)->registry, registry);
	kp_table_resize(ks, registry, KTAP_RIDX_LAST, 0);
	setthvalue(ks, &mt, ks);
	kp_table_setint(ks, registry, KTAP_RIDX_MAINTHREAD, &mt);
	sethvalue(&mt, kp_table_new(ks));
	kp_table_setint(ks, registry, KTAP_RIDX_GLOBALS, &mt);
}
开发者ID:joelagnel,项目名称:ktap,代码行数:12,代码来源:vm.c

示例7: init_registry

/*
** Create registry table and its predefined values
*/
static void init_registry (lua_State *L, global_State *g) {
  TValue temp;
  /* create registry */
  Table *registry = luaH_new(L);
  sethvalue(L, &g->l_registry, registry);
  luaH_resize(L, registry, LUA_RIDX_LAST, 0);
  /* registry[LUA_RIDX_MAINTHREAD] = L */
  setthvalue(L, &temp, L);  /* temp = L */
  luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp);
  /* registry[LUA_RIDX_GLOBALS] = table of globals */
  sethvalue(L, &temp, luaH_new(L));  /* temp = new table (global table) */
  luaH_setint(L, registry, LUA_RIDX_GLOBALS, &temp);
}
开发者ID:duchuan123,项目名称:ravi,代码行数:16,代码来源:lstate.c

示例8: init_registry

/*
** Create registry table and its predefined values
*/
static void init_registry (LUA_State *L, global_State *g) {
  TValue mt;
  /* create registry */
  Table *registry = LUAH_new(L);
  sethvalue(L, &g->l_registry, registry);
  LUAH_resize(L, registry, LUA_RIDX_LAST, 0);
  /* registry[LUA_RIDX_MAINTHREAD] = L */
  setthvalue(L, &mt, L);
  LUAH_setint(L, registry, LUA_RIDX_MAINTHREAD, &mt);
  /* registry[LUA_RIDX_GLOBALS] = table of globals */
  sethvalue(L, &mt, LUAH_new(L));
  LUAH_setint(L, registry, LUA_RIDX_GLOBALS, &mt);
}
开发者ID:mniip,项目名称:LUA,代码行数:16,代码来源:Lstate.c

示例9: lua_newthread

LuaObject LuaState::CreateThread(LuaState* parentState)
{
    lua_State* L1 = lua_newthread(LuaState_to_lua_State(parentState));
    lua_TValue tobject;
#if LUA_REFCOUNT
    setnilvalue2n(L1, &tobject);
#else
    setnilvalue(&tobject);
#endif /* LUA_REFCOUNT */
    setthvalue(parentState->GetCState(), &tobject, L1);

	LuaObject retObj = LuaObject(lua_State_To_LuaState(L1), &tobject);
    setnilvalue(&tobject);
    lua_pop(LuaState_to_lua_State(parentState), 1);
    return retObj;
}
开发者ID:killvxk,项目名称:WebbrowserLock,代码行数:16,代码来源:LuaPlus_Libs.cpp

示例10: tostate

lua_State *luaE_newthread (lua_State *L) {
  lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State)));
  luaC_link(L, obj2gco(L1), LUA_TTHREAD);
  setthvalue(L, L->top, L1); /* put thread on stack */
  incr_top(L);
  preinit_state(L1, G(L));
  stack_init(L1, L);  /* init stack */
  setobj2n(L, gt(L1), gt(L));  /* share table of globals */
  L1->hookmask = L->hookmask;
  L1->basehookcount = L->basehookcount;
  L1->hook = L->hook;
  resethookcount(L1);
  lua_assert(!isdead(G(L), obj2gco(L1)));
  L->top--; /* remove thread from stack */
  return L1;
}
开发者ID:cls22,项目名称:eLua-PIC32-,代码行数:16,代码来源:lstate.c

示例11: lua_lock

LUA_API lua_State *lua_newthread (lua_State *L) {
  lua_State *L1;
  lua_lock(L);
  luaC_checkGC(L);
  L1 = &luaC_newobj(L, LUA_TTHREAD, sizeof(LX), NULL, offsetof(LX, l))->th;
  setthvalue(L, L->top, L1);
  api_incr_top(L);
  preinit_state(L1, G(L));
  L1->hookmask = L->hookmask;
  L1->basehookcount = L->basehookcount;
  L1->hook = L->hook;
  resethookcount(L1);
  luai_userstatethread(L, L1);
  stack_init(L1, L);  /* init stack */
  lua_unlock(L);
  return L1;
}
开发者ID:q3k,项目名称:Cucumber,代码行数:17,代码来源:lstate.c


注:本文中的setthvalue函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。