1)
It looks like wait_count is never initialized to zero.
hythread_monitor_init_with_name()
initializes notify_flag to zero.  Thus it seems logical that wait_count
would also need to be intialized to zero.

2)
wait_count and notify_flag appear to serve the same purpose.  Are both
variables neccessary?

3)
Why does hythread_monitor_notify_all() do:

  mon_ptr->notify_flag = mon_ptr->wait_count;

and hythread_monitor_notify() do:

  if (mon_ptr->notify_flag < mon_ptr->wait_count)
        mon_ptr->notify_flag +=1;
4)
As far as I can tell, setting both wait_count and notify_flag to arbitrary
values will not impact the proper delivery of Object.notify() or
Object.notifyAll().  Is this a correct understanding?

5)
The only impact of these variables is the return value of
hythread_monitor_num_waiting().  Is this a correct understanding?

6)
I suspect hythread_monitor_num_waiting() is only used to give someone
debugging an idea of how many threads where waiting at a given object at a
point in the past.  Is this a correct understanding?  The
hythread_monitor_num_waiting() return value does not have to be the current
state of the system but a value of -75688 would probably cause the person
who is debugging to, well, report a bug in the debugger.

--
Weldon Washburn
Intel Enterprise Solutions Software Division

Reply via email to