Hacker News new | ask | show | jobs
by innes 5370 days ago
2. API ties windows to threads

What UI APIs are there that don't have a concept of UI thread(s)? Coming from Windows, I'm used to UI work needing to be done on a UI thread.

I randomly googled these comments:

"Never, ever, touch the UI from outside your UI thread, in any version of Qt."

"Android UI toolkit is not thread-safe and must always be manipulated on the UI thread."

google "iOS 'non-UI thread'": 60 million results.

javascript: everything UI-related runs on one thread.

Do you do much UI coding?

1 comments

This is about an OS-layer API, not a windowing toolkit API. Tying the window to a thread at this layer makes it impossible to have a single-threaded UI application. It is inflexible.
"This is about an OS-layer API, not a windowing toolkit API"

What does that even mean? Of course you can have single-threaded UI applications in Windows, the majority of them are. Have you ever written a Windows application in C or C++?

What exactly is the problem with the approach?
Sorry. I've read your comment a couple of times and am unable to make any sense of it. Win32 is a (dated, clunky) API for writing GUIs (in part). "OS-layer" is babble in this context.

And yeah, i would stop signing your posts - it comes across as conceited somehow; like each comment is a big deal.