harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weldon Washburn" <weldon...@gmail.com>
Subject [drlvm][threading] questions about wait_count and notify_flag in thread_native_fat_monitor.c
Date Mon, 27 Nov 2006 00:30:04 GMT
It looks like wait_count is never initialized to zero.
initializes notify_flag to zero.  Thus it seems logical that wait_count
would also need to be intialized to zero.

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

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;
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?

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

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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message