[cp-patches] RFC: JDWP startup synchronization (revisited)

Tom Tromey tromey at redhat.com
Fri Jun 16 15:55:55 UTC 2006


>>>>> "Keith" == Keith Seitz <keiths at redhat.com> writes:

Keith> While this *is* hacky (a thread exit doesn't really sound like a very
Keith> explicit/obvious way of implementing this), but it is extremely
Keith> simple. I tried using "standard" Object.wait-like stuff for this, but
Keith> it seems to me that while this would be trivial to implement with gcj,
Keith> it might be quite sloppy in other VMs which have to use JNI. [Besides
Keith> I haven't gotten that to work properly with gij -- it seems I can't
Keith> get something(s) set up sufficiently to allow Object.wait to be
Keith> called.]

I'm probably missing something, since it looks like your patch does
use wait/notify.

I'm not overly concerned about the mechanics of how this works.  If
it doesn't satisfy some VM we can always revisit it.

Keith> +	while (_initCount != 2)
Keith> +	  {
Keith> +	    synchronized (_initLock)
Keith> +	      {
Keith> +		_initLock.wait ();
Keith> +	      }
Keith> +	  }

Probably put the synchronized around the loop instead of inside it,
so the _initCount check is synchronized.

Tom



More information about the Classpath-patches mailing list