Index: libcfa/src/concurrency/mutex_stmt.hfa
===================================================================
--- libcfa/src/concurrency/mutex_stmt.hfa	(revision 1b97976c642f3a6d89db6c57bbf763b7b73bd784)
+++ libcfa/src/concurrency/mutex_stmt.hfa	(revision 1b97976c642f3a6d89db6c57bbf763b7b73bd784)
@@ -0,0 +1,46 @@
+#include "bits/algorithm.hfa"
+#include <assert.h>
+#include "invoke.h"
+#include "stdlib.hfa"
+#include <stdio.h>
+
+//-----------------------------------------------------------------------------
+// is_lock
+trait is_lock(L & | sized(L)) {
+	// For acquiring a lock
+	void lock( L & );
+
+	// For releasing a lock
+	void unlock( L & );
+};
+
+forall(L & | is_lock(L)) {
+
+    struct __mutex_stmt_lock_guard {
+        L ** lockarr;
+        __lock_size_t count;
+    };
+    
+    static inline void ?{}( __mutex_stmt_lock_guard(L) & this, L * lockarr [], __lock_size_t count  ) {
+        this.lockarr = lockarr;
+        this.count = count;
+
+        // Sort locks based on address
+        __libcfa_small_sort(this.lockarr, count);
+
+        // acquire locks in order
+        for ( size_t i = 0; i < count; i++ ) {
+            lock(*this.lockarr[i]);
+        }
+    }
+    
+    static inline void ^?{}( __mutex_stmt_lock_guard(L) & this ) with(this) {
+        for ( size_t i = count; i > 0; i-- ) {
+            unlock(*lockarr[i - 1]);
+        }
+    }
+
+    static inline L * __get_pointer( L & lock ) {
+        return &lock;
+    }
+}
