Re: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev
> On Mar 19, 2023, at 1:02 PM, Alan Snyder wrote: > > Your comments don’t make sense to me. > > You either post an event to run the code on the main thread or, if you are on > the main thread, you run the code directly. > > Running the code directly is what invoking a block does. > > How is

Re: OS/X Java native bug

2023-03-19 Thread Alan Snyder via Cocoa-dev
Your comments don’t make sense to me. You either post an event to run the code on the main thread or, if you are on the main thread, you run the code directly. Running the code directly is what invoking a block does. How is that unnecessary? Would it make more sense if the parameter were named

Re: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev
> On Mar 19, 2023, at 11:48 AM, Michael Hall wrote: > > > >> On Mar 19, 2023, at 10:50 AM, Alex Zavatone wrote: >> >> Would it make sense to intentionally cause this in one test case and then >> try dispatching on another queue at an intentional lower priority? >> >> I’m just brainstorm

Re: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev
> On Mar 19, 2023, at 10:50 AM, Alex Zavatone wrote: > > Would it make sense to intentionally cause this in one test case and then try > dispatching on another queue at an intentional lower priority? > > I’m just brainstorming here to create a specific case that we know causes it, > then e

Re: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev
> On Mar 19, 2023, at 10:37 AM, Alex Zavatone wrote: > > So while I am waiting for my coffee to actually start working, which > approaches do we think make sense here? > > When starting up, check if thread == main and if so, do one thing, else do > the other? > > If this is correct, what wo

Re: OS/X Java native bug

2023-03-19 Thread Alex Zavatone via Cocoa-dev
Would it make sense to intentionally cause this in one test case and then try dispatching on another queue at an intentional lower priority? I’m just brainstorming here to create a specific case that we know causes it, then examines other dispatch options at lower quality of service levels. A

Re: OS/X Java native bug

2023-03-19 Thread Alex Zavatone via Cocoa-dev
So while I am waiting for my coffee to actually start working, which approaches do we think make sense here? When starting up, check if thread == main and if so, do one thing, else do the other? If this is correct, what would each option be? Is this an appropriate summary or a vast oversimplif

Re: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev
> On Mar 18, 2023, at 4:46 AM, Michael Hall wrote: > >> On Mar 17, 2023, at 7:49 AM, Alan Snyder > > wrote: >> >> block() means invoke the block > > > Not exactly and it still seems unnecessary here. > > It appears to convert the block to a selector and then t

Re: OS/X Java native bug

2023-03-18 Thread Michael Hall via Cocoa-dev
> On Mar 18, 2023, at 4:46 AM, Michael Hall wrote: > > The main differences seeming to be that it takes a pass through the CFRunLoop > doing an invokeBlockCopy After seeing this (java_md_macosx.m JVMInit sameThread is true)… /* * We cannot use dispatch_sync here, bec

Re: OS/X Java native bug

2023-03-18 Thread Michael Hall via Cocoa-dev
> On Mar 17, 2023, at 7:49 AM, Alan Snyder wrote: > > block() means invoke the block Not exactly and it still seems unnecessary here. It appears to convert the block to a selector and then to invoke it. Eliminate the comments and NSLog’s and I think the following is equivalent and a bit m

Re: OS/X Java native bug

2023-03-17 Thread Michael Hall via Cocoa-dev
> On Mar 17, 2023, at 7:49 AM, Alan Snyder wrote: > > block() means invoke the block > >> On Mar 17, 2023, at 5:34 AM, Michael Hall via Cocoa-dev >> wrote: >> >> >> >>> On Mar 17, 2023, at 6:51 AM, Michael Hall wrote: >>> >>> >>> Sorry, I looked at your link and am still not sure

Re: OS/X Java native bug

2023-03-17 Thread Michael Hall via Cocoa-dev
> On Mar 17, 2023, at 6:51 AM, Michael Hall wrote: > >> > > Sorry, I looked at your link and am still not sure this is correct if you are > already on the main thread. > Searching shows this used enough places you would think it has to be correct. Again, I guess maybe I’ll try a little de

Re: OS/X Java native bug

2023-03-17 Thread Michael Hall via Cocoa-dev
> On Mar 17, 2023, at 6:31 AM, Michael Hall wrote: > > > >> On Mar 17, 2023, at 4:07 AM, Saagar Jha wrote: >> >> The implementation of -[ThreadUtilities performOnMainThreadWaiting:block:] >> does the right thing here, which is calling the block directly if it’s >> already running on the m

Re: OS/X Java native bug

2023-03-17 Thread Michael Hall via Cocoa-dev
> On Mar 17, 2023, at 4:07 AM, Saagar Jha wrote: > > The implementation of -[ThreadUtilities performOnMainThreadWaiting:block:] > does the right thing here, which is calling the block directly if it’s > already running on the main thread: > https://github.com/openjdk/jdk/blob/9d518c528b11953

Re: OS/X Java native bug

2023-03-17 Thread Saagar Jha via Cocoa-dev
The implementation of -[ThreadUtilities performOnMainThreadWaiting:block:] does the right thing here, which is calling the block directly if it’s already running on the main thread: https://github.com/openjdk/jdk/blob/9d518c528b11953b556aa7585fc69ff9c9a22435/src/java.desktop/macosx/native/libosx