mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-25 06:50:46 -08:00
Block profiling signals in the Android UI thread
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New function `setupSystemThread'. * java/org/gnu/emacs/EmacsService.java (onCreate): Block all signals except for SIGBUS and SIGSEGV in the UI thread. * src/android.c (setupSystemThread): New function.
This commit is contained in:
parent
7f073df533
commit
c321eea5af
3 changed files with 53 additions and 0 deletions
|
|
@ -188,6 +188,10 @@ public final class EmacsNative
|
|||
KEYCODE_VOLUME_MUTE should be forwarded to Emacs. */
|
||||
public static native boolean shouldForwardMultimediaButtons ();
|
||||
|
||||
/* Initialize the current thread, by blocking signals that do not
|
||||
interest it. */
|
||||
public static native void setupSystemThread ();
|
||||
|
||||
|
||||
|
||||
/* Input connection functions. These mostly correspond to their
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.io.UnsupportedEncodingException;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
|
|
@ -211,6 +212,7 @@ public final class EmacsService extends Service
|
|||
final String filesDir, libDir, cacheDir, classPath;
|
||||
final double pixelDensityX;
|
||||
final double pixelDensityY;
|
||||
final Semaphore signalSemaphore;
|
||||
|
||||
SERVICE = this;
|
||||
handler = new Handler (Looper.getMainLooper ());
|
||||
|
|
@ -220,6 +222,7 @@ public final class EmacsService extends Service
|
|||
pixelDensityX = metrics.xdpi;
|
||||
pixelDensityY = metrics.ydpi;
|
||||
resolver = getContentResolver ();
|
||||
signalSemaphore = new Semaphore (0);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -248,11 +251,33 @@ public final class EmacsService extends Service
|
|||
cacheDir, (float) pixelDensityX,
|
||||
(float) pixelDensityY,
|
||||
classPath, EmacsService.this);
|
||||
|
||||
/* Wait for the signal mask to be set up in the UI
|
||||
thread. */
|
||||
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
signalSemaphore.acquire ();
|
||||
break;
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
;;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, extraStartupArgument,
|
||||
/* If any file needs to be opened, open it now. */
|
||||
EmacsOpenActivity.fileToOpen);
|
||||
thread.start ();
|
||||
|
||||
/* Now that the thread has been started, block signals which
|
||||
don't interest the current thread. */
|
||||
|
||||
EmacsNative.setupSystemThread ();
|
||||
signalSemaphore.release ();
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue