MCPcopy Create free account
hub / github.com/apache/trafficserver / ts_lua_create_vm

Function ts_lua_create_vm

plugins/lua/ts_lua_util.cc:112–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112int
113ts_lua_create_vm(ts_lua_main_ctx *arr, int n)
114{
115 int i;
116 lua_State *L;
117
118 for (i = 0; i < n; i++) {
119 L = ts_lua_new_state();
120
121 if (L == nullptr)
122 return -1;
123
124 lua_pushvalue(L, LUA_GLOBALSINDEX);
125
126 arr[i].gref = luaL_ref(L, LUA_REGISTRYINDEX); /* L[REG][gref] = L[GLOBAL] */
127 arr[i].lua = L;
128 arr[i].mutexp = TSMutexCreate();
129 arr[i].stats = ts_lua_create_ctx_stats();
130 }
131
132 return 0;
133}
134
135void
136ts_lua_destroy_vm(ts_lua_main_ctx *arr, int n)

Callers 1

create_lua_vmsFunction · 0.85

Calls 3

ts_lua_new_stateFunction · 0.85
TSMutexCreateFunction · 0.85
ts_lua_create_ctx_statsFunction · 0.85

Tested by

no test coverage detected