Browse Source

For for hi-res timer threads on android.

tags/2021-05-28
jules 11 years ago
parent
commit
6bb3a4b74f
2 changed files with 9 additions and 7 deletions
  1. +6
    -0
      modules/juce_core/native/juce_android_JNIHelpers.h
  2. +3
    -7
      modules/juce_core/native/juce_posix_SharedCode.h

+ 6
- 0
modules/juce_core/native/juce_android_JNIHelpers.h View File

@@ -362,6 +362,12 @@ private:
extern ThreadLocalJNIEnvHolder threadLocalJNIEnvHolder;
struct AndroidThreadScope
{
AndroidThreadScope() { threadLocalJNIEnvHolder.attach(); }
~AndroidThreadScope() { threadLocalJNIEnvHolder.detach(); }
};
//==============================================================================
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \
METHOD (createNewView, "createNewView", "(ZJ)L" JUCE_ANDROID_ACTIVITY_CLASSPATH "$ComponentPeerView;") \


+ 3
- 7
modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -837,12 +837,6 @@ extern "C" void* threadEntryProc (void* userData)
JUCE_AUTORELEASEPOOL
{
#if JUCE_ANDROID
struct AndroidThreadScope
{
AndroidThreadScope() { threadLocalJNIEnvHolder.attach(); }
~AndroidThreadScope() { threadLocalJNIEnvHolder.detach(); }
};
const AndroidThreadScope androidEnv;
#endif
@@ -1184,7 +1178,9 @@ private:
static void* timerThread (void* param)
{
#if ! JUCE_ANDROID
#if JUCE_ANDROID
const AndroidThreadScope androidEnv;
#else
int dummy;
pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, &dummy);
#endif


Loading…
Cancel
Save