Article View: borland.public.jbuilder.java.language
Article #14969Re: Yield, sleep or wait
From: Hugo Ferreira
Date: Wed, 21 Jul 1999 00:00
Date: Wed, 21 Jul 1999 00:00
34 lines
1536 bytes
1536 bytes
Johan, I totally agree with you. It made debugging asynchronous events very difficult. Thanx. Hugo. Johan Forsberg wrote in message <7n4ha0$k049@forums.borland.com>... > >Hugo Ferreira <HugoF@cocaina.inescn.pt> skrev i >diskussionsgruppsmeddelandet:7n4bkg$ji214@forums.borland.com... >> Tor, >> >> >> My question is: what does yield do ? >> > >> >public static void yield() >> > >> >Causes the currently executing thread object to temporarily pause and >> >allow other threads to execute. >> > >> >> I know, but : say I call yield within a synchronized block. >> Will it release any monitors like wait, or not like the sleep ? > >Not. >It's only purpose is to let other threads execute for one time slice. >I'm really rather curious as to why this method exists at all. >Yield() makes sense in a cooperatively multithreaded environment >(Macintosh?) but no-one ever uses it anyway, so what's the point? > > >
Technical Details
Message-ID:
<7n4o5c$k0027@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7mve5r$fbg9@forums.borland.com> <u3dyjg5g3.fsf@sds.no> <7n4bkg$ji214@forums.borland.com> <7n4ha0$k049@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,45bb88477a8645d X-Google-Attributes: gidf74b3,public From: "Hugo Ferreira" <HugoF@cocaina.inescn.pt> Subject: Re: Yield, sleep or wait Date: 1999/07/21 Message-ID: <7n4o5c$k0027@forums.borland.com> X-Deja-AN: 503562518 References: <7mve5r$fbg9@forums.borland.com> <u3dyjg5g3.fsf@sds.no> <7n4bkg$ji214@forums.borland.com> <7n4ha0$k049@forums.borland.com> Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3612.1700 Newsgroups: borland.public.jbuilder.java.language