X_Trust
X_Trust

Reputation: 817

What is the proper syntax for Mutex

I can not figure out what is wrong with the following but I keep getting syntax errors for the closing "}" brace. I was under the assumption that this was the proper syntax for Mutex based on http://www.ruby-doc.org/core-2.0.0/Mutex.html

  semaphore = Mutex.new 

  semaphore.synchronize {
    r_failure.push( username )
    thread_count--
  }

Upvotes: 0

Views: 47

Answers (1)

sawa
sawa

Reputation: 168101

Your problem has nothing to do with Mutex. The problem is:

thread_count--

You cannot use - in a variable name or a method (unless doing it in a special, unusual way).

Upvotes: 1

Related Questions