File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -300,6 +300,21 @@ fluid_synth_init(void)
300
300
#endif
301
301
#endif
302
302
303
+ /*
304
+ * Disable OpenMP thread affinity on Android to prevent crashes.
305
+ *
306
+ * On several Android devices (particularly Xiaomi), OpenMP's attempt to set thread
307
+ * affinity fails with EINVAL, causing process abortion during parallel SoundFont loading.
308
+ * This is due to an unresolved bug in Android NDK's OpenMP implementation
309
+ * (see https://github.com/android/ndk/issues/1180).
310
+ */
311
+ #ifdef __ANDROID__
312
+ if (setenv ("KMP_AFFINITY" , "disabled" , 1 ) != 0 )
313
+ {
314
+ FLUID_LOG (FLUID_WARN , "Failed to disable KMP_AFFINITY, OpenMP crashes may occur on some devices!" );
315
+ }
316
+ #endif
317
+
303
318
init_dither ();
304
319
305
320
/* custom_breath2att_mod is not a default modulator specified in SF2.01.
You can’t perform that action at this time.
0 commit comments