Comment

Comment by zanker_swe

Sorry, I meant to write:

  synchronized(this) {
    a = AcquireLock();
    for(c = 0; c < 100; c++) {
        f();
    }
  }
  ReleaseLock(a);
which is inline with what the blog post was proposing.

To repeat the blog is a question:

  for (...) {
    synchronized (obj) {
      // something
    }
  }
…​could it optimize into this?

  synchronized (this) {
    for (...) {
       // something
    }
  }
My answer to that is in general, no.
parent zanker_swe 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton