This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234615 - Run things on main thread
Summary: Run things on main thread
Status: RESOLVED INVALID
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.3.1
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-19 21:54 UTC by SirIntellegence
Modified: 2013-12-18 14:41 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Suggested main thread invoke code (6.24 KB, patch)
2013-10-15 21:17 UTC, SirIntellegence
Details | Diff
Suggested main thread invoke code V2 (6.19 KB, text/plain)
2013-10-15 21:24 UTC, SirIntellegence
Details
Suggested main thread invoke code V3 (6.46 KB, text/plain)
2013-10-15 21:28 UTC, SirIntellegence
Details
Suggested main thread invoke code V4 (6.54 KB, text/plain)
2013-10-19 00:05 UTC, SirIntellegence
Details
Suggested main thread invoke code V5 (6.68 KB, patch)
2013-10-19 02:35 UTC, SirIntellegence
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description SirIntellegence 2013-08-19 21:54:54 UTC
Hello, I have recently noticed that with some mac native things, you are required to run some things on the main thread, so I was wondering if you could add the ability to Queue Runnables on the main thread while it is waiting for the platform to finish running.
Comment 1 Antonin Nebuzelsky 2013-08-22 15:32:13 UTC
Jarda, what is your take on this question?
Comment 2 Jaroslav Tulach 2013-08-23 10:12:04 UTC
Why not, but you need to show us the code. Attach your suggested patch and reopen.
Comment 3 SirIntellegence 2013-10-15 21:17:30 UTC
Created attachment 141117 [details]
Suggested main thread invoke code

I was thinking of something like this, adding MainThreadRunner.runDeamon() to the end of MainImpl.main
Would that work?
I would test it, but I don't know where the host project is to build Netbeans XD
Comment 4 SirIntellegence 2013-10-15 21:24:47 UTC
Created attachment 141118 [details]
Suggested main thread invoke code V2

This one might be safer without the nested synchronized blocks
Comment 5 SirIntellegence 2013-10-15 21:28:28 UTC
Created attachment 141119 [details]
Suggested main thread invoke code V3

This one handles InvokeAndWait exeptions better
Comment 6 SirIntellegence 2013-10-19 00:05:22 UTC
Created attachment 141282 [details]
Suggested main thread invoke code V4

Fixed the logical impossibility of actually doing an invoke operation due to not notifying the main thread....
Comment 7 SirIntellegence 2013-10-19 02:35:53 UTC
Created attachment 141286 [details]
Suggested main thread invoke code V5

Then add a dependency on Bootstrap for Execution API, and append this to the ManImpl.main(String[]) method:
ThreadRunner.runDeamon(ThreadRunner.getDefault());
Comment 8 SirIntellegence 2013-10-29 00:54:25 UTC
I have noticed that it doesn't like being in Execution API, so I put it in lookup, and that seems to work
Comment 9 Jaroslav Tulach 2013-12-18 14:41:49 UTC
Version five does not look like a diff that could be applied. Closing.