Пример #1
0
int embPattern_addThread(EmbPattern* p, EmbThread thread)
{
    if(!p) { embLog_error("emb-pattern.c embPattern_addThread(), p argument is null\n"); return 0; }
    if(embThreadList_empty(p->threadList))
    {
        p->threadList = p->lastThread = embThreadList_create(thread);
    }
    else
    {
        p->lastThread = embThreadList_add(p->lastThread, thread);
    }
    return 1;
}
Пример #2
0
int embPattern_addThread(EmbPattern* p, EmbThread thread)
{
    if(!p) { embLog_error("emb-pattern.c embPattern_addThread(), p argument is null\n"); return 0; }
    if(!(p->threadList))
    {
        EmbThreadList* t = (EmbThreadList*)malloc(sizeof(EmbThreadList));
        if(!t) { embLog_error("emb-pattern.c embPattern_addThread(), unable to allocate memory for t\n"); return 0; }
        t->thread = thread;
        t->next = 0;
        p->threadList = t;
    }
    else
    {
        embThreadList_add(p->threadList, thread);
    }
    return 1;
}
Пример #3
0
int embPattern_addThread(EmbPattern* p, EmbThread thread)
{
    /* TODO: pointer safety */
    if(!(p->threadList))
    {
        EmbThreadList* t = (EmbThreadList*)malloc(sizeof(EmbThreadList));
        if(!t) { /* TODO: error allocating memory */ return 0; }
        t->thread = thread;
        t->next = NULL;
        p->threadList = t;
    }
    else
    {
        embThreadList_add(p->threadList, thread);
    }
    return 1;
}