aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-06-17 12:07:40 +0800
committerPo Lu2023-06-17 12:07:40 +0800
commit797c30b7abc165d5ebe65474c7398ccad0e3023c (patch)
tree86598bd005f85684a8ff67dc5c67cce9548fcc1f /java
parentfa821ed18639aa1b0275c2938af9987c0c71b581 (diff)
downloademacs-797c30b7abc165d5ebe65474c7398ccad0e3023c.tar.gz
emacs-797c30b7abc165d5ebe65474c7398ccad0e3023c.zip
Initialize signal mask earlier
* java/org/gnu/emacs/EmacsService.java (onCreate, run): Don't initialize signal mask here. * java/org/gnu/emacs/EmacsApplication.java (onCreate): Do it here instead. * src/android.c (JNICALL): Restore previous signal masks.
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsApplication.java8
-rw-r--r--java/org/gnu/emacs/EmacsService.java25
2 files changed, 8 insertions, 25 deletions
diff --git a/java/org/gnu/emacs/EmacsApplication.java b/java/org/gnu/emacs/EmacsApplication.java
index d8b77acdf9e..8afa5bcedb4 100644
--- a/java/org/gnu/emacs/EmacsApplication.java
+++ b/java/org/gnu/emacs/EmacsApplication.java
@@ -78,7 +78,15 @@ public final class EmacsApplication extends Application
78 public void 78 public void
79 onCreate () 79 onCreate ()
80 { 80 {
81 /* Block signals which don't interest the current thread and its
82 descendants created by the system. The original signal mask
83 will be restored for the Emacs thread in `initEmacs'. */
84 EmacsNative.setupSystemThread ();
85
86 /* Locate a suitable dump file. */
81 findDumpFile (this); 87 findDumpFile (this);
88
89 /* Start the rest of the application. */
82 super.onCreate (); 90 super.onCreate ();
83 } 91 }
84}; 92};
diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java
index 2fe4e8c4146..820befb52d2 100644
--- a/java/org/gnu/emacs/EmacsService.java
+++ b/java/org/gnu/emacs/EmacsService.java
@@ -25,7 +25,6 @@ import java.io.UnsupportedEncodingException;
25 25
26import java.util.List; 26import java.util.List;
27 27
28import java.util.concurrent.Semaphore;
29import java.util.concurrent.atomic.AtomicInteger; 28import java.util.concurrent.atomic.AtomicInteger;
30 29
31import android.graphics.Matrix; 30import android.graphics.Matrix;
@@ -212,7 +211,6 @@ public final class EmacsService extends Service
212 final String filesDir, libDir, cacheDir, classPath; 211 final String filesDir, libDir, cacheDir, classPath;
213 final double pixelDensityX; 212 final double pixelDensityX;
214 final double pixelDensityY; 213 final double pixelDensityY;
215 final Semaphore signalSemaphore;
216 214
217 SERVICE = this; 215 SERVICE = this;
218 handler = new Handler (Looper.getMainLooper ()); 216 handler = new Handler (Looper.getMainLooper ());
@@ -222,7 +220,6 @@ public final class EmacsService extends Service
222 pixelDensityX = metrics.xdpi; 220 pixelDensityX = metrics.xdpi;
223 pixelDensityY = metrics.ydpi; 221 pixelDensityY = metrics.ydpi;
224 resolver = getContentResolver (); 222 resolver = getContentResolver ();
225 signalSemaphore = new Semaphore (0);
226 223
227 try 224 try
228 { 225 {
@@ -251,33 +248,11 @@ public final class EmacsService extends Service
251 cacheDir, (float) pixelDensityX, 248 cacheDir, (float) pixelDensityX,
252 (float) pixelDensityY, 249 (float) pixelDensityY,
253 classPath, EmacsService.this); 250 classPath, EmacsService.this);
254
255 /* Wait for the signal mask to be set up in the UI
256 thread. */
257
258 while (true)
259 {
260 try
261 {
262 signalSemaphore.acquire ();
263 break;
264 }
265 catch (InterruptedException e)
266 {
267 ;;
268 }
269 }
270 } 251 }
271 }, extraStartupArgument, 252 }, extraStartupArgument,
272 /* If any file needs to be opened, open it now. */ 253 /* If any file needs to be opened, open it now. */
273 EmacsOpenActivity.fileToOpen); 254 EmacsOpenActivity.fileToOpen);
274 thread.start (); 255 thread.start ();
275
276 /* Now that the thread has been started, block signals which
277 don't interest the current thread. */
278
279 EmacsNative.setupSystemThread ();
280 signalSemaphore.release ();
281 } 256 }
282 catch (IOException exception) 257 catch (IOException exception)
283 { 258 {