[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110921: Fix problems in ns port foun
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110921: Fix problems in ns port found by static checking. |
Date: |
Sat, 17 Nov 2012 07:15:49 -0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110921
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2012-11-17 07:15:49 -0800
message:
Fix problems in ns port found by static checking.
* nsterm.m: Include <pthread.h>, for pthread_mutex_lock etc.
(hold_event, setPosition:portion:whole:): Send SIGIO only to self,
not to process group.
(ns_select): Use emacs_write, not write, as that's more robust
in the presence of signals.
(fd_handler:): Check for read errors.
modified:
src/ChangeLog
src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-11-16 17:20:23 +0000
+++ b/src/ChangeLog 2012-11-17 15:15:49 +0000
@@ -1,3 +1,13 @@
+2012-11-17 Paul Eggert <address@hidden>
+
+ Fix problems in ns port found by static checking.
+ * nsterm.m: Include <pthread.h>, for pthread_mutex_lock etc.
+ (hold_event, setPosition:portion:whole:): Send SIGIO only to self,
+ not to process group.
+ (ns_select): Use emacs_write, not write, as that's more robust
+ in the presence of signals.
+ (fd_handler:): Check for read errors.
+
2012-11-16 Glenn Morris <address@hidden>
* editfns.c (Fmessage): Mention message-log-max. (Bug#12849)
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2012-11-16 17:20:23 +0000
+++ b/src/nsterm.m 2012-11-17 15:15:49 +0000
@@ -31,6 +31,7 @@
#include <config.h>
#include <math.h>
+#include <pthread.h>
#include <sys/types.h>
#include <time.h>
#include <signal.h>
@@ -331,7 +332,7 @@
hold_event_q.q[hold_event_q.nr++] = *event;
/* Make sure ns_read_socket is called, i.e. we have input. */
- kill (0, SIGIO);
+ raise (SIGIO);
}
static Lisp_Object
@@ -3389,7 +3390,7 @@
if ([NSApp modalWindow] != nil)
return -1;
- if (hold_event_q.nr > 0)
+ if (hold_event_q.nr > 0)
{
int i;
for (i = 0; i < hold_event_q.nr; ++i)
@@ -3504,7 +3505,7 @@
/* Inform fd_handler that select should be called */
c = 'g';
- write (selfds[1], &c, 1);
+ emacs_write (selfds[1], &c, 1);
}
else if (nr == 0 && timeout)
{
@@ -3537,7 +3538,7 @@
if (nr > 0 && readfds)
{
c = 's';
- write (selfds[1], &c, 1);
+ emacs_write (selfds[1], &c, 1);
}
unblock_input ();
@@ -4576,11 +4577,8 @@
FD_SET (selfds[0], &fds);
result = select (selfds[0]+1, &fds, NULL, NULL, NULL);
- if (result > 0)
- {
- read (selfds[0], &c, 1);
- if (c == 'g') waiting = 0;
- }
+ if (result > 0 && read (selfds[0], &c, 1) == 1 && c == 'g')
+ waiting = 0;
}
else
{
@@ -4620,8 +4618,8 @@
{
if (FD_ISSET (selfds[0], &readfds))
{
- read (selfds[0], &c, 1);
- if (c == 's') waiting = 1;
+ if (read (selfds[0], &c, 1) == 1 && c == 's')
+ waiting = 1;
}
else
{
@@ -6696,7 +6694,7 @@
/* Events may come here even if the event loop is not running.
If we don't enter the event loop, the scroll bar will not update.
So send SIGIO to ourselves. */
- if (apploopnr == 0) kill (0, SIGIO);
+ if (apploopnr == 0) raise (SIGIO);
return self;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110921: Fix problems in ns port found by static checking.,
Paul Eggert <=