Hacker News new | past | comments | ask | show | jobs | submit login

Might want to move foo.add() out of the lock scope (assuming foo is a thread-private resource):

    value = nil
    lock {
      if (data.size() > 0) {
        value = data.pop()
      }
    }
    if (value) {
        foo.add(value)
    }



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: