Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
amahfouz
Posts: 29
Registered: ‎06-23-2009
My Device: Not Specified

Thread.yield() on the event thread

Are there known issues with using Thread.yield(), especially when it is called on the event thread?

Please use plain text.
Developer
peter_strange
Posts: 19,598
Registered: ‎07-14-2008
My Device: Not Specified

Re: Thread.yield() on the event thread

I don't think a Thread.yield will not give up the Event Lock, so I would not use it when running on the Event Thread.

 

I do use it elsewhere, where I think appropriate, though it is hard to be sure it is working as I would expect,

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Thread.yield() on the event thread

I can't think of a situation where Thread.yield() is appropriate for the event thread.

 

If you are trying this, then you probably really need to spawn a worker thread and allow the event thread to return to the dispatcher.

 

Is there a specific situation you are facing that you feel calls for this strategy?

 

 

Please use plain text.
Developer
amahfouz
Posts: 29
Registered: ‎06-23-2009
My Device: Not Specified

Re: Thread.yield() on the event thread

Thanks.

I am just debugging a mysterious bug and I was trying to exclude possible causes, so I thought I should check the usage of yield as a potential cause.

Please use plain text.