This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug driver/36081] gcc optimizations and threads (pthread)



------- Comment #8 from pinskia at gcc dot gnu dot org  2008-04-29 19:11 -------
>And for syncing the threads, that's the easiest way.

Use mutexes then, they are designed exactly for this.

>I don't want so serialize the threads, I want to use all 2 processors of my
dual-core.

You are serializing them by doing a busy loop.  In fact using a busy loop will
just make the CPUs spin without doing anything except for checking a condition.
 Using a mutex allows for other stuff to happen while that thread is waiting
for more work to do.

I guess you need to read up on threading programming more because right now you
are causing extra work to happen on thread for no reason.

-- Pinski


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36081


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]