Пример #1
0
/*
 * Callback function to delete a JSThread info when the thread that owns it
 * is destroyed.
 */
void JS_DLL_CALLBACK
js_ThreadDestructorCB(void *ptr)
{
    JSThread *thread = (JSThread *)ptr;

    if (!thread)
        return;
    while (!JS_CLIST_IS_EMPTY(&thread->contextList))
        JS_REMOVE_AND_INIT_LINK(thread->contextList.next);
    free(thread);
}
Пример #2
0
static void _freeProps(JSDContext* jsdc, JSDValue* jsdval)
{
    JSDProperty* jsdprop;

    while(jsdprop = (JSDProperty*)jsdval->props.next,
          jsdprop != (JSDProperty*)&jsdval->props)
    {
        JS_REMOVE_AND_INIT_LINK(&jsdprop->links);
        jsd_DropProperty(jsdc, jsdprop);
    }
    JS_ASSERT(JS_CLIST_IS_EMPTY(&jsdval->props));
    CLEAR_BIT_FLAG(jsdval->flags, GOT_PROPS);
}
Пример #3
0
/* Remove the owning thread info of a context. */
void
js_ClearContextThread(JSContext *cx)
{
    /*
     * If cx is associated with a thread, this must be called only from that
     * thread.  If not, this is a harmless no-op.
     */
    JS_ASSERT(cx->thread == js_GetCurrentThread(cx->runtime) || !cx->thread);
    JS_REMOVE_AND_INIT_LINK(&cx->threadLinks);
#ifdef DEBUG
    if (JS_CLIST_IS_EMPTY(&cx->thread->contextList)) {
        memset(cx->thread->gcFreeLists, JS_FREE_PATTERN,
               sizeof(cx->thread->gcFreeLists));
    }
#endif
    cx->thread = NULL;
}