Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re-entrancy, Thread-safety, Cocoa, and 1.4.1



It sounds like Java-Cocoa has a bright future, which is very exciting news.
I hope that as part of all this, Cocoa becomes a little more thread-safe.
A simple test case that can yield one case of breakage is as follows:

1. Create a new Java-Cocoa project.
2. Edit the NIB file in IB.
3. Drag out a NSTabView with two tabs into your window.
4. Drag out a NSTextView (enclosed in an NSScrollView), into the tab view - first tab.
5. Connect the tab view and text view to their own outlets in a controller instance.
6. Implement the controller.
7. From the controller, maybe in applicationDidFinishLaunching(), spawn a thread associated either with a socket or something else that appends NSAttributedString objects into the text viw and scrolls the view to the bottom when done.
8. When text is coming in from the background thread, toggle between the two tabs rapidly.

This is a guaranteed way to crash the application. One of many ways. I have plenty of other test cases like this which produce unexpected results. I personally believe that rudimentary thread-safety in the UI classes at least is a very good goal to have. Things like chat programs and what-not that will want to have threads for sockets and the like would really enjoy a thread-safe AppKit.

Keep up the great work,
Steve
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.