Example #1
0
File: main.c Project: wuwx/simba
int test_get_by_name(struct harness_t *harness_p)
{
    BTASSERT(thrd_get_by_name("main") == thrd_self());
    BTASSERT(thrd_get_by_name("none") == NULL);

    return (0);
}
Example #2
0
static mp_obj_t module_thrd_get_by_name(mp_obj_t name_in)
{
    void *thrd_p;

    thrd_p = thrd_get_by_name(mp_obj_str_get_str(name_in));

    if (thrd_p == NULL) {
        nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError,
                                                "No such thread: '%s'",
                                                mp_obj_str_get_str(name_in)));
    }

    return (mp_obj_new_int((uintptr_t)thrd_p));
}