Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] Re: Re: Info about Manta multi-threading


Chronological Thread 
  • From: James Bigler < >
  • To:
  • Cc: Biagio Cosenza < >
  • Subject: [Manta] Re: Re: Info about Manta multi-threading
  • Date: Fri, 5 Jun 2009 14:00:14 -0600
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; b=KYr1uYPvfDmLJPqTOlANWXxfit6vYLix3nY5xmoHhX7U6R1wDYkL5f1m5AixKo9aGL bR2JvgmmOlbPI3JWuLfKcst6AV0sdn1WPOuq81utvNMgt4vMDn5D0fPfQ+9+eRpmLzrz p+eERt2tbq60rGoZAc2KLmlLng8oMU2p7ids0=



On Fri, Jun 5, 2009 at 1:27 PM, Abe Stephens < "> > wrote:
Hi, I've added comments inline.

On Jun 5, 2009, at 9:47 AM, Biagio Cosenza wrote:

1st)
Is there in Manta code (maybe in Core/Thread ?) something to easily implement this:

if(I'm the first thread arrived here){
  //  do something
}

instead of

if(context.proc == 0){
  //  do something
}


I don't think this construction occurs anywhere in the code, but it should be possible using the methods in Semaphore, e.g. if (semaphore.tryDown()) { // I'm the first. }. Of course the semaphore would need to be incremented from a safe place earlier in the render loop, perhaps in an animation callback.


Along the same lines, an atomic counter would be useful.  Everyone tries to increment the counter, and whoever got zero back would be the first one.  Of course this also requires resetting the counter somewhere.
 
James



Archive powered by MHonArc 2.6.16.

Top of page