Article View: borland.public.jbuilder.java.language
Article #14967SV: Yield, sleep or wait
From: Johan Forsberg
Date: Wed, 21 Jul 1999 00:00
Date: Wed, 21 Jul 1999 00:00
21 lines
1320 bytes
1320 bytes
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:
<7n4ha0$k049@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>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,45bb88477a8645d X-Google-Attributes: gidf74b3,public From: "Johan Forsberg" <jfo@stmf.se> Subject: SV: Yield, sleep or wait Date: 1999/07/21 Message-ID: <7n4ha0$k049@forums.borland.com> X-Deja-AN: 503519795 References: <7mve5r$fbg9@forums.borland.com> <u3dyjg5g3.fsf@sds.no> <7n4bkg$ji214@forums.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.language