RFR: 8011882: Replace spin loops as back off when suspending

Rickard Bäckman rickard.backman at oracle.com
Thu Apr 11 22:01:05 PDT 2013


On Apr 12, 2013, at 1:04 AM, David Holmes wrote:

> On 11/04/2013 11:02 PM, Rickard Bäckman wrote:
>> On Apr 11, 2013, at 2:39 PM, David Holmes wrote:
>>> So what did you mean about pthread_semaphore (what is that anyway?) ??
>> 
>> Never mind, pthread condition variables.
> 
> Ah I see.
> 
>>> 
>>> I really, really, really don't like seeing three versions of this class :( Can't BSD and Linux at least share a POSIX version? (And I wonder if we can actually mix-n-match UI threads on Solaris with POSIX semaphores on Solaris?)
>> 
>> I don't like it either, our OS code isn't really helpful when it comes do reusing things :) Not sure how I would layout things to make them only available on BSD (Not Mac) and Linux. I guess os_posix.hpp with lots of #ifdefs, but I'm not sure I"m feeling that happy about that.
> 
> Why would the os_posix version need a lot of ifdefs?

Well, I guess we would need:

(in ifdef pseudo language)

#ifdef (LINUX || (BSD && !APPLE))
…
#endif

The second interesting problem this will get us into is that sem_t is not declared in this context. Where do we put the #include <semaphore.h>? Impossible in os_posix.hpp since it is included in the middle of a class definition. I could put it in os.hpp in the #ifdef path that does the jvm_platform.h includes, not sure if that is very pretty either.

> 
> Do we really have four versions:
> - linux (posix)
> - BSD (posix)
> - Solaris
> - Mac (different to BSD?)
> 

3:
1) linux & bsd uses the sem_ interface
2) solaris uses the sema_ interface
3) mac uses the semaphore_ interface

/R

> ??
> 
> David
> -----



More information about the hotspot-runtime-dev mailing list