Example #1
0
int    yCreateDetachedThread(void* (*fun)(void *), void *arg)
{
    osThread th_hdl;
    if (yCreateDetachedThreadEx(&th_hdl, fun, arg) < 0) {
        return -1;
    }
    yReleaseDetachedThreadEx(&th_hdl);
    return 0;
}
Example #2
0
void yThreadKill(yThread *yth)
{
    if (yThreadIsRunning(yth)) {
#ifdef WINDOWS_API
        //means thread still running lets give it some time
        if (!yWaitForEvent(&yth->th, 1000)) {
            yKillThread(&yth->th);
        }
#else
        yKillThread(&yth->th);
#endif
    } else {
        yWaitEndThread(&yth->th);
        yReleaseDetachedThreadEx(&yth->th);
    }
}
Example #3
0
int    yThreadWaitEnd(yThread *yth)
{
	int res = yWaitEndThread(&yth->th);   
	yReleaseDetachedThreadEx(&yth->th);
	return res;
}