move the owner tag inside
parent
468c3a07d4
commit
c854e9d189
|
@ -560,7 +560,6 @@ struct LIBCUBESCRIPT_EXPORT state {
|
|||
void swap(state &s) {
|
||||
std::swap(p_tstate, s.p_tstate);
|
||||
std::swap(identflags, s.identflags);
|
||||
std::swap(p_owner, s.p_owner);
|
||||
}
|
||||
|
||||
state new_thread();
|
||||
|
@ -733,8 +732,6 @@ private:
|
|||
ident *add_ident(ident *id, ident_impl *impl);
|
||||
|
||||
void *alloc(void *ptr, size_t olds, size_t news);
|
||||
|
||||
bool p_owner = false;
|
||||
};
|
||||
|
||||
struct stack_state_node {
|
||||
|
|
|
@ -71,7 +71,7 @@ state::state(alloc_func func, void *data) {
|
|||
|
||||
p_tstate->pstate = this;
|
||||
p_tstate->istate = statep;
|
||||
p_owner = true;
|
||||
p_tstate->owner = true;
|
||||
|
||||
for (int i = 0; i < MAX_ARGUMENTS; ++i) {
|
||||
char buf[32];
|
||||
|
@ -188,7 +188,7 @@ LIBCUBESCRIPT_EXPORT state::~state() {
|
|||
}
|
||||
|
||||
LIBCUBESCRIPT_EXPORT void state::destroy() {
|
||||
if (!p_tstate || !p_owner) {
|
||||
if (!p_tstate || !p_tstate->owner) {
|
||||
return;
|
||||
}
|
||||
auto *sp = p_tstate->istate;
|
||||
|
@ -205,9 +205,7 @@ LIBCUBESCRIPT_EXPORT void state::destroy() {
|
|||
sp->destroy(sp);
|
||||
}
|
||||
|
||||
state::state(internal_state *s):
|
||||
p_owner{false}
|
||||
{
|
||||
state::state(internal_state *s) {
|
||||
p_tstate = s->create<thread_state>(s);
|
||||
p_tstate->istate = s;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ struct thread_state {
|
|||
hook_func call_hook{};
|
||||
/* loop nesting level */
|
||||
int loop_level = 0;
|
||||
/* whether we own the internal state (i.e. not a side thread */
|
||||
bool owner = false;
|
||||
|
||||
thread_state(internal_state *cs);
|
||||
|
||||
|
|
Loading…
Reference in New Issue