From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28293 invoked by alias); 29 Apr 2008 19:12:54 -0000 Received: (qmail 27226 invoked by uid 48); 29 Apr 2008 19:11:53 -0000 Date: Tue, 29 Apr 2008 19:12:00 -0000 Message-ID: <20080429191153.27225.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug driver/36081] gcc optimizations and threads (pthread) In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg02097.txt.bz2 ------- 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