Index: doc/theses/thierry_delisle_PhD/code/readyQ_proto/work_stealing.hpp
===================================================================
--- doc/theses/thierry_delisle_PhD/code/readyQ_proto/work_stealing.hpp	(revision 634a5c2cfc247bd35869699a7cb6837b3cff9483)
+++ doc/theses/thierry_delisle_PhD/code/readyQ_proto/work_stealing.hpp	(revision 780a61412318cddfec5ff2b3146c9767ee2388b4)
@@ -28,16 +28,28 @@
 template<typename node_t>
 struct __attribute__((aligned(128))) localQ_t {
-	// volatile unsigned long long val = 0;
-	// mpsc_queue<node_t> queue = {};
-	// spinlock_t lock = {};
-	intrusive_queue_t<node_t> list;
-
-	inline auto ts() { return list.ts(); }
-	inline auto lock() { return list.lock.lock(); }
-	inline auto try_lock() { return list.lock.try_lock(); }
-	inline auto unlock() { return list.lock.unlock(); }
-
-	inline auto push( node_t * node ) { return list.push( node ); }
-	inline auto pop() { return list.pop(); }
+	#ifdef NO_MPSC
+		intrusive_queue_t<node_t> list;
+
+		inline auto ts() { return list.ts(); }
+		inline auto lock() { return list.lock.lock(); }
+		inline auto try_lock() { return list.lock.try_lock(); }
+		inline auto unlock() { return list.lock.unlock(); }
+
+		inline auto push( node_t * node ) { return list.push( node ); }
+		inline auto pop() { return list.pop(); }
+	#else
+		mpsc_queue<node_t> queue = {};
+		spinlock_t _lock = {};
+
+		inline auto ts() { auto h = queue.head(); return h ? h->_links.ts : 0ull; }
+		inline auto lock() { return _lock.lock(); }
+		inline auto try_lock() { return _lock.try_lock(); }
+		inline auto unlock() { return _lock.unlock(); }
+
+		inline auto push( node_t * node ) { return queue.push( node ); }
+		inline auto pop() { return queue.pop(); }
+	#endif
+
+
 };
 
@@ -73,5 +85,7 @@
 		auto & list = *({
 			unsigned i;
-			do {
+			#ifdef NO_MPSC
+				do {
+			#endif
 				tls.stats.push.attempt++;
 				// unsigned r = tls.rng1.next();
@@ -82,10 +96,14 @@
 					i = tls.my_queue + (r % nqueues);
 				}
-			} while(!lists[i].try_lock());
+			#ifdef NO_MPSC
+				} while(!lists[i].try_lock());
+			#endif
 		 	&lists[i];
 		});
 
 		list.push( node );
-		list.unlock();
+		#ifdef NO_MPSC
+			list.unlock();
+		#endif
 		// tls.rng2.set_raw_state( tls.rng1.get_raw_state());
 		// count++;
@@ -95,20 +113,21 @@
 	__attribute__((noinline, hot)) node_t * pop() {
 		if(tls.my_queue != outside) {
-			if( tls.myfriend == outside ) {
-				auto r  = tls.rng1.next();
-				tls.myfriend = r % numThreads;
-				tls.mytime = lists[(tls.it % nqueues) + tls.my_queue].ts();
-				// times[tls.myfriend].val = 0;
-				// lists[tls.myfriend].val = 0;
-			}
-			// else if(times[tls.myfriend].val == 0) {
-			// else if(lists[tls.myfriend].val == 0) {
-			else if(times[tls.myfriend].val < tls.mytime) {
-			// else if(times[tls.myfriend].val < lists[(tls.it % nqueues) + tls.my_queue].ts()) {
-				node_t * n = try_pop(tls.myfriend, tls.stats.pop.help);
-				tls.stats.help++;
-				tls.myfriend = outside;
-				if(n) return n;
-			}
+			// if( tls.myfriend == outside ) {
+			// 	auto r  = tls.rng1.next();
+			// 	tls.myfriend = r % numThreads;
+			// 	// assert(lists[(tls.it % nqueues) + tls.my_queue].ts() >= lists[((tls.it + 1) % nqueues) + tls.my_queue].ts());
+			// 	tls.mytime = std::min(lists[(tls.it % nqueues) + tls.my_queue].ts(), lists[((tls.it + 1) % nqueues) + tls.my_queue].ts());
+			// 	// times[tls.myfriend].val = 0;
+			// 	// lists[tls.myfriend].val = 0;
+			// }
+			// // else if(times[tls.myfriend].val == 0) {
+			// // else if(lists[tls.myfriend].val == 0) {
+			// else if(times[tls.myfriend].val < tls.mytime) {
+			// // else if(times[tls.myfriend].val < lists[(tls.it % nqueues) + tls.my_queue].ts()) {
+			// 	node_t * n = try_pop(tls.myfriend, tls.stats.pop.help);
+			// 	tls.stats.help++;
+			// 	tls.myfriend = outside;
+			// 	if(n) return n;
+			// }
 			// if( tls.myfriend == outside ) {
 			// 	auto r  = tls.rng1.next();
@@ -141,4 +160,7 @@
 	inline node_t * local() {
 		unsigned i = (--tls.it % nqueues) + tls.my_queue;
+		node_t * n = try_pop(i, tls.stats.pop.local);
+		if(n) return n;
+		i = (--tls.it % nqueues) + tls.my_queue;
 		return try_pop(i, tls.stats.pop.local);
 	}
@@ -192,8 +214,13 @@
 		list.unlock();
 		stat.success++;
-		// times[i].val = 1;
-		times[i].val = node.first->_links.ts;
-		// lists[i].val = node.first->_links.ts;
-		return node.first;
+		#ifdef NO_MPSC
+			// times[i].val = 1;
+			times[i].val = node.first->_links.ts;
+			// lists[i].val = node.first->_links.ts;
+			return node.first;
+		#else
+			times[i].val = node->_links.ts;
+			return node;
+		#endif
 	}
 
