[threadpool] Fix alignment of ThreadPoolWorkerCounter (#4871)
authorLudovic Henry <ludovic@xamarin.com>
Tue, 16 May 2017 02:19:34 +0000 (22:19 -0400)
committerGitHub <noreply@github.com>
Tue, 16 May 2017 02:19:34 +0000 (22:19 -0400)
It is accessed with a 64bits atomic operation, so it needs to be 64bits aligned, even on a 32bits platform. A CPU exception EXC_ARM_DA_ALIGN triggers on armv7 32bits.

Fix https://bugzilla.xamarin.com/show_bug.cgi?id=56202

mono/metadata/threadpool-worker-default.c

index cfcecf95a85e73d07860d22ffdcc2419e3b2142c..6c851db7370086b8abf12131ac74ef18e9b0f223 100644 (file)
@@ -118,7 +118,11 @@ typedef union {
                gint16 parked; /* parked */
        } _;
        gint64 as_gint64;
-} ThreadPoolWorkerCounter;
+} ThreadPoolWorkerCounter
+#ifdef __GNUC__
+__attribute__((aligned(64)))
+#endif
+;
 
 typedef struct {
        MonoRefCount ref;