RFR: 8087322: Implement a Semaphore utility class

Kim Barrett kim.barrett at oracle.com
Sat Jun 13 00:23:02 UTC 2015

On Jun 12, 2015, at 5:08 PM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
> On 2015-06-12 21:36, Kim Barrett wrote:
>>> So, according to the example the error number is returned in errno, AFAICT.
>> OK, the description in the documentation I’m looking at is unclear.  Maybe there is more
>> recent documentation?  (What I’m looking at says last revised in 1998, but this kind of stuff
>> tends to be quite stable.)
>> You are probably correct, but having the semantics hidden away in examples is <expletive deleted>.
> And now that I read the example above I see that it checks against EAGAIN, but the sema_post documentation mentions EBUSY. So I'm confused.

It’s EBUSY in both places in the Solaris 11.2 documentation; the EAGAIN in the example appears to be a doc bug that has been fixed.

>>>> src/share/vm/utilities/semaphore.hpp
>>>> The Semaphore class should not be copyable or copy-assignable.
>>> The same goes for Monitor and Mutex, right? I'll fix this for Semaphore.
>> And probably a whole lot of other classes.  This is one of those hygiene things whose
>> lack irritates me about this code base.  I don’t know if I should be trying to change it
>> or just get used to the way it is.
> Maybe we should create a couple of RFEs and clean up some of the classes, just to get things moving in the right direction?

Sure, but we should take this discussion elsewhere.

I’m ok with leaving the Semaphore class as is for now, pending that discussion.

More information about the hotspot-dev mailing list