Index: src/libcfa/concurrency/monitor
===================================================================
--- src/libcfa/concurrency/monitor	(revision c1a9c86b33a7a40edb9fb80f386caddc59c72d52)
+++ src/libcfa/concurrency/monitor	(revision 59a0bdecc428b48723c9445329fdf464edbb9d8c)
@@ -41,5 +41,5 @@
 struct monitor_guard_t {
 	monitor_desc ** m;
-	int count;
+	__lock_size_t   count;
 	monitor_desc ** prev_mntrs;
 	__lock_size_t   prev_count;
@@ -47,5 +47,5 @@
 };
 
-void ?{}( monitor_guard_t & this, monitor_desc ** m, int count, void (*func)() );
+void ?{}( monitor_guard_t & this, monitor_desc ** m, __lock_size_t count, void (*func)() );
 void ^?{}( monitor_guard_t & this );
 
@@ -105,5 +105,5 @@
 };
 
-void ?{}(__condition_node_t & this, thread_desc * waiting_thread, unsigned short count, uintptr_t user_info );
+void ?{}(__condition_node_t & this, thread_desc * waiting_thread, __lock_size_t count, uintptr_t user_info );
 void ?{}(__condition_criterion_t & this );
 void ?{}(__condition_criterion_t & this, monitor_desc * target, __condition_node_t * owner );
Index: src/libcfa/concurrency/monitor.c
===================================================================
--- src/libcfa/concurrency/monitor.c	(revision c1a9c86b33a7a40edb9fb80f386caddc59c72d52)
+++ src/libcfa/concurrency/monitor.c	(revision 59a0bdecc428b48723c9445329fdf464edbb9d8c)
@@ -46,10 +46,10 @@
 static inline thread_desc *        check_condition   ( __condition_criterion_t * );
 static inline void                 brand_condition   ( condition & );
-static inline [thread_desc *, int] search_entry_queue( const __waitfor_mask_t &, monitor_desc * monitors [], int count );
+static inline [thread_desc *, int] search_entry_queue( const __waitfor_mask_t &, monitor_desc * monitors [], __lock_size_t count );
 
 forall(dtype T | sized( T ))
-static inline short insert_unique( T * array [], short & size, T * val );
-static inline short count_max    ( const __waitfor_mask_t & mask );
-static inline short aggregate    ( monitor_desc * storage [], const __waitfor_mask_t & mask );
+static inline __lock_size_t insert_unique( T * array [], __lock_size_t & size, T * val );
+static inline __lock_size_t count_max    ( const __waitfor_mask_t & mask );
+static inline __lock_size_t aggregate    ( monitor_desc * storage [], const __waitfor_mask_t & mask );
 
 //-----------------------------------------------------------------------------
@@ -67,5 +67,5 @@
 #define monitor_ctx( mons, cnt )                                /* Define that create the necessary struct for internal/external scheduling operations */ \
 	monitor_desc ** monitors = mons;                          /* Save the targeted monitors                                                          */ \
-	unsigned short count = cnt;                               /* Save the count to a local variable                                                  */ \
+	__lock_size_t count = cnt;                                /* Save the count to a local variable                                                  */ \
 	unsigned int recursions[ count ];                         /* Save the current recursion levels to restore them later                             */ \
 	__waitfor_mask_t masks [ count ];                         /* Save the current waitfor masks to restore them later                                */ \
@@ -153,5 +153,5 @@
 		}
 
-		int count = 1;
+		__lock_size_t count = 1;
 		monitor_desc ** monitors = &this;
 		__monitor_group_t group = { &this, 1, func };
@@ -272,5 +272,5 @@
 // relies on the monitor array being sorted
 static inline void enter( __monitor_group_t monitors ) {
-	for(int i = 0; i < monitors.size; i++) {
+	for( __lock_size_t i = 0; i < monitors.size; i++) {
 		__enter_monitor_desc( monitors.list[i], monitors );
 	}
@@ -279,6 +279,6 @@
 // Leave multiple monitor
 // relies on the monitor array being sorted
-static inline void leave(monitor_desc * monitors [], int count) {
-	for(int i = count - 1; i >= 0; i--) {
+static inline void leave(monitor_desc * monitors [], __lock_size_t count) {
+	for( __lock_size_t i = count - 1; i >= 0; i--) {
 		__leave_monitor_desc( monitors[i] );
 	}
@@ -287,5 +287,5 @@
 // Ctor for monitor guard
 // Sorts monitors before entering
-void ?{}( monitor_guard_t & this, monitor_desc * m [], int count, fptr_t func ) {
+void ?{}( monitor_guard_t & this, monitor_desc * m [], __lock_size_t count, fptr_t func ) {
 	// Store current array
 	this.m = m;
@@ -350,5 +350,5 @@
 //-----------------------------------------------------------------------------
 // Internal scheduling types
-void ?{}(__condition_node_t & this, thread_desc * waiting_thread, unsigned short count, uintptr_t user_info ) {
+void ?{}(__condition_node_t & this, thread_desc * waiting_thread, __lock_size_t count, uintptr_t user_info ) {
 	this.waiting_thread = waiting_thread;
 	this.count = count;
@@ -395,5 +395,5 @@
 
 	// Find the next thread(s) to run
-	short thread_count = 0;
+	__lock_size_t thread_count = 0;
 	thread_desc * threads[ count ];
 	__builtin_memset( threads, 0, sizeof( threads ) );
@@ -403,5 +403,5 @@
 
 	// Remove any duplicate threads
-	for( int i = 0; i < count; i++) {
+	for( __lock_size_t i = 0; i < count; i++) {
 		thread_desc * new_owner = next_thread( monitors[i] );
 		insert_unique( threads, thread_count, new_owner );
@@ -436,5 +436,5 @@
 	);
 
-	unsigned short count = this.monitor_count;
+	__lock_size_t count = this.monitor_count;
 
 	// Lock all monitors
@@ -523,10 +523,10 @@
 	// This statment doesn't have a contiguous list of monitors...
 	// Create one!
-	short max = count_max( mask );
+	__lock_size_t max = count_max( mask );
 	monitor_desc * mon_storage[max];
 	__builtin_memset( mon_storage, 0, sizeof( mon_storage ) );
-	short actual_count = aggregate( mon_storage, mask );
-
-	LIB_DEBUG_PRINT_BUFFER_DECL( "Kernel : waitfor %d (s: %d, m: %d)\n", actual_count, mask.size, (short)max);
+	__lock_size_t actual_count = aggregate( mon_storage, mask );
+
+	LIB_DEBUG_PRINT_BUFFER_DECL( "Kernel : waitfor %d (s: %d, m: %d)\n", actual_count, mask.size, (__lock_size_t)max);
 
 	if(actual_count == 0) return;
@@ -615,5 +615,5 @@
 	set_mask( monitors, count, mask );
 
-	for(int i = 0; i < count; i++) {
+	for( __lock_size_t i = 0; i < count; i++) {
 		verify( monitors[i]->owner == this_thread );
 	}
@@ -691,5 +691,5 @@
 static inline bool is_accepted( monitor_desc * this, const __monitor_group_t & group ) {
 	__acceptable_t * it = this->mask.clauses; // Optim
-	int count = this->mask.size;
+	__lock_size_t count = this->mask.size;
 
 	// Check if there are any acceptable functions
@@ -700,5 +700,5 @@
 
 	// For all acceptable functions check if this is the current function.
-	for( short i = 0; i < count; i++, it++ ) {
+	for( __lock_size_t i = 0; i < count; i++, it++ ) {
 		if( *it == group ) {
 			*this->mask.accepted = i;
@@ -823,5 +823,5 @@
 }
 
-static inline [thread_desc *, int] search_entry_queue( const __waitfor_mask_t & mask, monitor_desc * monitors [], int count ) {
+static inline [thread_desc *, int] search_entry_queue( const __waitfor_mask_t & mask, monitor_desc * monitors [], __lock_size_t count ) {
 
 	__thread_queue_t & entry_queue = monitors[0]->entry_queue;
@@ -850,8 +850,8 @@
 
 forall(dtype T | sized( T ))
-static inline short insert_unique( T * array [], short & size, T * val ) {
+static inline __lock_size_t insert_unique( T * array [], __lock_size_t & size, T * val ) {
 	if( !val ) return size;
 
-	for(int i = 0; i <= size; i++) {
+	for( __lock_size_t i = 0; i <= size; i++) {
 		if( array[i] == val ) return size;
 	}
@@ -862,7 +862,7 @@
 }
 
-static inline short count_max( const __waitfor_mask_t & mask ) {
-	short max = 0;
-	for( int i = 0; i < mask.size; i++ ) {
+static inline __lock_size_t count_max( const __waitfor_mask_t & mask ) {
+	__lock_size_t max = 0;
+	for( __lock_size_t i = 0; i < mask.size; i++ ) {
 		max += mask.clauses[i].size;
 	}
@@ -870,9 +870,9 @@
 }
 
-static inline short aggregate( monitor_desc * storage [], const __waitfor_mask_t & mask ) {
-	short size = 0;
-	for( int i = 0; i < mask.size; i++ ) {
+static inline __lock_size_t aggregate( monitor_desc * storage [], const __waitfor_mask_t & mask ) {
+	__lock_size_t size = 0;
+	for( __lock_size_t i = 0; i < mask.size; i++ ) {
 		__libcfa_small_sort( mask.clauses[i].list, mask.clauses[i].size );
-		for( int j = 0; j < mask.clauses[i].size; j++) {
+		for( __lock_size_t j = 0; j < mask.clauses[i].size; j++) {
 			insert_unique( storage, size, mask.clauses[i].list[j] );
 		}
