You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by "Roger L. Whitcomb" <Ro...@ingres.com> on 2011/04/22 18:28:37 UTC

What is legal to do in second thread?

Trying to understand the Pivot threading model:  what is okay to do in a
background thread re: the GUI objects?

-          Is it legal to change the data model (of a TreeView or
similar)?

-          Is it legal to update the text of a TextInput (or similar)?

 

What are the implications of doing things that aren't "legal"?  Are we
threatening to crash or destabilize the JVM?  Or is it that we may have
race conditions or data corruption because data structures are not
thread-safe?

 

Thanks.

 

Roger Whitcomb

Architect, Engineering

Ingres Corporation

roger.whitcomb@ingres.com <ma...@ingres.com> 

 

PHONE +1 650.587.5596

FAX +1 650.587.5550

 

www.ingres.com <http://www.ingres.com/>  

 

This transmission is confidential and intended solely for the use of the
recipient named above. It may contain confidential, proprietary, or
legally privileged information. If you are not the intended recipient,
you are hereby notified that any unauthorized review, use, disclosure or
distribution is strictly prohibited. If you have received this
transmission in error, please contact the sender by reply e-mail and
delete the original transmission and all copies from your system.

 


RE: What is legal to do in second thread?

Posted by "Roger L. Whitcomb" <Ro...@ingres.com>.
Thanks, Greg.

 

Roger Whitcomb | Architect, Engineering | Roger.Whitcomb@ingres.com
<ma...@ingres.com> | Ingres | 500 Arguello Street |
Suite 200 | Redwood City | CA | 94063 | USA
<http://www.google.com/maps?f=q&hl=en&geocode=&q=500+Arguello+Street+%7C
+Suite+200+%7C+Redwood+City+%7C+CA+%7C+94063+%7C+USA+&sll=37.0625,-95.67
7068&sspn=50.557552,73.037109&ie=UTF8&t=h&z=16&iwloc=addr>  | +1
650-587-5596 | fax: +1 650-587-5550

From: Greg Brown [mailto:gk_brown@verizon.net] 
Sent: Friday, April 22, 2011 10:07 AM
To: user@pivot.apache.org
Subject: Re: What is legal to do in second thread?

 

	Trying to understand the Pivot threading model:  what is okay to
do in a background thread re: the GUI objects?

	-          Is it legal to change the data model (of a TreeView
or similar)?

 

Nope.





-          Is it legal to update the text of a TextInput (or similar)?

 

Nope.




What are the implications of doing things that aren't "legal"?  Are we
threatening to crash or destabilize the JVM?  

 

Probably not.





Or is it that we may have race conditions or data corruption because
data structures are not thread-safe?

 

Yes, that is possible.

 

Pivot's threading model is basically the same as Swing's - any UI
updates need to be done on the UI thread. Any time you want to call into
the UI thread from a background thread, you need to call
ApplicationContext#queueCallback().

 

G

 


Re: What is legal to do in second thread?

Posted by Greg Brown <gk...@verizon.net>.
> Trying to understand the Pivot threading model:  what is okay to do in a background thread re: the GUI objects?
> -          Is it legal to change the data model (of a TreeView or similar)?

Nope.

> -          Is it legal to update the text of a TextInput (or similar)?

Nope.

> What are the implications of doing things that aren’t “legal”?  Are we threatening to crash or destabilize the JVM? 

Probably not.

> Or is it that we may have race conditions or data corruption because data structures are not thread-safe?

Yes, that is possible.

Pivot's threading model is basically the same as Swing's - any UI updates need to be done on the UI thread. Any time you want to call into the UI thread from a background thread, you need to call ApplicationContext#queueCallback().

G