title: C# monitors (from a Java developer POV)
body: <p>I'm working on the port of a C#/directx game client to Java, so that I can learn some C# (as I am completely profane on it) and in the meanwhile improve my knowledge on a java opengl engine.</p>
  
  <p>When I encounter something like the following:</p>
  
  <pre><code>Monitor.Enter(preloadDictionary);
  try {
       foreach (PreloadEntry entry in preloadDictionary.Values) {
           if (entry.loaded) continue;
           return entry;
       }
  } finally {
       Monitor.Exit(preloadDictionary);
  }
  </code></pre>
  
  <p>can i assume it is like the following?</p>
  
  <pre><code>syncronized(preloadDictionary) {
       [...]
  }
  </code></pre>
  
  <p>And in the case of:</p>
  
  <pre><code>Monitor.Enter(worldServerMap);
  try {
       worldServerMap[rv.WorldName] = entry;
       Monitor.PulseAll(worldServerMap);
  } finally {
       Monitor.Exit(worldServerMap);
  }
  </code></pre>
  
  <p>is the additional <code>PulseAll()</code> like a <code>notifyAll()</code> to wake up all thread waiting on the resource? (but i could not find any place in the code where <code>Monitor.Wait()</code> is called).</p>