code: private static void queueTask(long threadId, Runnable toRun){
      assert control.isHeldByCurrentThread();
      assert threadId != currentThread;
      //(get queue)
      if(!threadedLogQueue.containsKey(threadId)){
        threadedLogQueue.put(threadId, new LinkedList<Runnable>());
      }
      Queue<Runnable> threadLogQueue = threadedLogQueue.get(threadId);
      //(add to queue)
      threadLogQueue.offer( toRun );
      //(register this thread as waiting)
      if(!threadsWaiting.contains(threadId)){
        threadsWaiting.offer(threadId);
        assert threadedLogQueue.get(threadId) != null && !threadedLogQueue.get(threadId).isEmpty();
      }
    }
docs: /*
  ---------------------------------------------------------
  HELPER METHODS
  ---------------------------------------------------------