On Thu, 16 Feb 2023 18:25:23 GMT, Marius Hanl <mh...@openjdk.org> wrote:

>> So someone is asking a question when they call this.
>> Throwing an Exception could be considered an unfriendly way of answering it.
>> It only makes sense if you think the programmer will have enough information 
>> to be sure that if S/HE does things correctly, it will always be the 
>> FxUserThread that is being used .. ie if we are in an event handler .. as is 
>> supposed to be the case .. and anything else is a blatant programming error 
>> that should be rewarded with an upfront response to that effect.
>> 
>> So
>> 1) programming error -> Exception
>> 2) Can't be sure -> return false.
>
> @prrace What is your preference here?
> Since `enterNestedEventLoop` and `exitNestedEventLoop` throw an exception 
> when not on the fx user thread, I feel like it makes sense to also add it 
> here as well.

Phil's comment got me thinking about this further. All other event loop 
methods, including `isNestedLoopRunning`, need to be called on the JavaFX 
thread. So I prefer option 1 as well for consistency.

-------------

PR: https://git.openjdk.org/jfx/pull/1031

Reply via email to