summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/sys/link.c
blob: 96f8eebfccda5dfadbd41a63833292cb21c0ac20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "sys/link.h"

jove_obj_t
link_unlink(jove_owned_obj_t *link)
{
    struct obj_link *linkval = obj_deref(link);
    if(--linkval->refcount == 1) {
        jove_obj_t held_obj = linkval->obj;
        link->locked = held_obj;
        return (jove_obj_t) {
            .lock = 0,
            .type = JOVE_OBJ_UNTYPED,
            .value = (uintptr_t)linkval
        };
    }else{
        obj_settype(link, JOVE_OBJ_NONE);
    }
    return (jove_obj_t) { 0 };
}