Re: Co-thread for parallel processing

Hendrik Visage <[email protected]> Sat, 3 Dec 2011 23:13:46 +0200
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <CADtGFvmHhhnafSkXJHLRQqhc_dd-r5DMf7t2355FvP1nqZ6iGw@mail.gmail.com>
On Fri, Dec 2, 2011 at 11:23 AM, Randi Botse <[email protected]> wrote:
> 1. What the proper way to the main thread to wait for all co-threads
> until finished?

I'll do a semop() with sem_op=1 in each thread's start, and a
sem_op=-1 when each thread's finished.
Then in the main thread I'll wait with a sem_op = 0.

> 2. After calling pthread_cond_signal() or pthread_cond_broadcast()
> followed by sleep()/nanosleep(),
>    the condition variable looks like not signaled, (the co-thread
> routine doesn't run). What make this?

Please show the code snippet in the co-thread that is not working as
well as the mainthread's method you try to wake up the co-threads
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html