Index: src/libcfa/concurrency/monitor.c
===================================================================
--- src/libcfa/concurrency/monitor.c	(revision 8fc45b762b4e8374629230668423504c051c14e7)
+++ src/libcfa/concurrency/monitor.c	(revision 513daecfd75605c6a42d821f2b9893c3f2cb260c)
@@ -26,6 +26,6 @@
 // Forward declarations
 static inline void set_owner ( monitor_desc * this, thread_desc * owner );
-static inline void set_owner ( monitor_desc * storage [], short count, thread_desc * owner );
-static inline void set_mask  ( monitor_desc * storage [], short count, const __waitfor_mask_t & mask );
+static inline void set_owner ( monitor_desc * storage [], __lock_size_t count, thread_desc * owner );
+static inline void set_mask  ( monitor_desc * storage [], __lock_size_t count, const __waitfor_mask_t & mask );
 static inline void reset_mask( monitor_desc * this );
 
@@ -33,14 +33,14 @@
 static inline bool is_accepted( monitor_desc * this, const __monitor_group_t & monitors );
 
-static inline void lock_all  ( spinlock * locks [], unsigned short count );
-static inline void lock_all  ( monitor_desc * source [], spinlock * /*out*/ locks [], unsigned short count );
-static inline void unlock_all( spinlock * locks [], unsigned short count );
-static inline void unlock_all( monitor_desc * locks [], unsigned short count );
-
-static inline void save   ( monitor_desc * ctx [], short count, spinlock * locks [], unsigned int /*out*/ recursions [], __waitfor_mask_t /*out*/ masks [] );
-static inline void restore( monitor_desc * ctx [], short count, spinlock * locks [], unsigned int /*in */ recursions [], __waitfor_mask_t /*in */ masks [] );
-
-static inline void init     ( int count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] );
-static inline void init_push( int count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] );
+static inline void lock_all  ( spinlock * locks [], __lock_size_t count );
+static inline void lock_all  ( monitor_desc * source [], spinlock * /*out*/ locks [], __lock_size_t count );
+static inline void unlock_all( spinlock * locks [], __lock_size_t count );
+static inline void unlock_all( monitor_desc * locks [], __lock_size_t count );
+
+static inline void save   ( monitor_desc * ctx [], __lock_size_t count, spinlock * locks [], unsigned int /*out*/ recursions [], __waitfor_mask_t /*out*/ masks [] );
+static inline void restore( monitor_desc * ctx [], __lock_size_t count, spinlock * locks [], unsigned int /*in */ recursions [], __waitfor_mask_t /*in */ masks [] );
+
+static inline void init     ( __lock_size_t count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] );
+static inline void init_push( __lock_size_t count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] );
 
 static inline thread_desc *        check_condition   ( __condition_criterion_t * );
@@ -330,5 +330,4 @@
 }
 
-
 // Ctor for monitor guard
 // Sorts monitors before entering
@@ -349,5 +348,4 @@
 	__enter_monitor_dtor( this.m, func );
 }
-
 
 // Dtor for monitor guard
@@ -661,8 +659,8 @@
 }
 
-static inline void set_owner( monitor_desc * monitors [], short count, thread_desc * owner ) {
+static inline void set_owner( monitor_desc * monitors [], __lock_size_t count, thread_desc * owner ) {
 	monitors[0]->owner     = owner;
 	monitors[0]->recursion = 1;
-	for( int i = 1; i < count; i++ ) {
+	for( __lock_size_t i = 1; i < count; i++ ) {
 		monitors[i]->owner     = owner;
 		monitors[i]->recursion = 0;
@@ -670,6 +668,6 @@
 }
 
-static inline void set_mask( monitor_desc * storage [], short count, const __waitfor_mask_t & mask ) {
-	for(int i = 0; i < count; i++) {
+static inline void set_mask( monitor_desc * storage [], __lock_size_t count, const __waitfor_mask_t & mask ) {
+	for( __lock_size_t i = 0; i < count; i++) {
 		storage[i]->mask = mask;
 	}
@@ -725,6 +723,6 @@
 }
 
-static inline void init( int count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) {
-	for(int i = 0; i < count; i++) {
+static inline void init( __lock_size_t count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) {
+	for( __lock_size_t i = 0; i < count; i++) {
 		(criteria[i]){ monitors[i], waiter };
 	}
@@ -733,6 +731,6 @@
 }
 
-static inline void init_push( int count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) {
-	for(int i = 0; i < count; i++) {
+static inline void init_push( __lock_size_t count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) {
+	for( __lock_size_t i = 0; i < count; i++) {
 		(criteria[i]){ monitors[i], waiter };
 		LIB_DEBUG_PRINT_SAFE( "Kernel :  target %p = %p\n", criteria[i].target, &criteria[i] );
@@ -743,12 +741,12 @@
 }
 
-static inline void lock_all( spinlock * locks [], unsigned short count ) {
-	for( int i = 0; i < count; i++ ) {
+static inline void lock_all( spinlock * locks [], __lock_size_t count ) {
+	for( __lock_size_t i = 0; i < count; i++ ) {
 		lock_yield( locks[i] DEBUG_CTX2 );
 	}
 }
 
-static inline void lock_all( monitor_desc * source [], spinlock * /*out*/ locks [], unsigned short count ) {
-	for( int i = 0; i < count; i++ ) {
+static inline void lock_all( monitor_desc * source [], spinlock * /*out*/ locks [], __lock_size_t count ) {
+	for( __lock_size_t i = 0; i < count; i++ ) {
 		spinlock * l = &source[i]->lock;
 		lock_yield( l DEBUG_CTX2 );
@@ -757,12 +755,12 @@
 }
 
-static inline void unlock_all( spinlock * locks [], unsigned short count ) {
-	for( int i = 0; i < count; i++ ) {
+static inline void unlock_all( spinlock * locks [], __lock_size_t count ) {
+	for( __lock_size_t i = 0; i < count; i++ ) {
 		unlock( locks[i] );
 	}
 }
 
-static inline void unlock_all( monitor_desc * locks [], unsigned short count ) {
-	for( int i = 0; i < count; i++ ) {
+static inline void unlock_all( monitor_desc * locks [], __lock_size_t count ) {
+	for( __lock_size_t i = 0; i < count; i++ ) {
 		unlock( &locks[i]->lock );
 	}
@@ -771,10 +769,10 @@
 static inline void save(
 	monitor_desc * ctx [],
-	short count,
+	__lock_size_t count,
 	__attribute((unused)) spinlock * locks [],
 	unsigned int /*out*/ recursions [],
 	__waitfor_mask_t /*out*/ masks []
 ) {
-	for( int i = 0; i < count; i++ ) {
+	for( __lock_size_t i = 0; i < count; i++ ) {
 		recursions[i] = ctx[i]->recursion;
 		masks[i]      = ctx[i]->mask;
@@ -784,5 +782,5 @@
 static inline void restore(
 	monitor_desc * ctx [],
-	short count,
+	__lock_size_t count,
 	spinlock * locks [],
 	unsigned int /*out*/ recursions [],
@@ -790,5 +788,5 @@
 ) {
 	lock_all( locks, count );
-	for( int i = 0; i < count; i++ ) {
+	for( __lock_size_t i = 0; i < count; i++ ) {
 		ctx[i]->recursion = recursions[i];
 		ctx[i]->mask      = masks[i];
