NS: Fix UI freezes and Lisp threads on GNUstep
* src/nsterm.m (ns_select_1): Return thread_select if current thread is not the main thread or timeout is zero; otherwise call 'thread_select' with a minimal timeout to allow other Lisp threads to run. (Bug#80110, Bug#80112)
This commit is contained in:
parent
31c07d873b
commit
b44053536d
1 changed files with 5 additions and 9 deletions
14
src/nsterm.m
14
src/nsterm.m
|
|
@ -5066,18 +5066,14 @@ ns_select_1 (int nfds, fd_set *readfds, fd_set *writefds,
|
|||
if (writefds && FD_ISSET(k, writefds)) ++nr;
|
||||
}
|
||||
|
||||
/* emacs -nw doesn't have an NSApp, so we're done. */
|
||||
if (NSApp == nil)
|
||||
return thread_select (pselect, nfds, readfds, writefds, exceptfds,
|
||||
timeout, sigmask);
|
||||
|
||||
if (![NSThread isMainThread]
|
||||
if (NSApp == nil
|
||||
|| ![NSThread isMainThread]
|
||||
|| (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
|
||||
thread_select (pselect, nfds, readfds, writefds,
|
||||
exceptfds, timeout, sigmask);
|
||||
return thread_select (pselect, nfds, readfds, writefds,
|
||||
exceptfds, timeout, sigmask);
|
||||
else
|
||||
{
|
||||
struct timespec t = {0, 0};
|
||||
struct timespec t = {0, 1};
|
||||
thread_select (pselect, 0, NULL, NULL, NULL, &t, sigmask);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue