Fork me on GitHub

Synchronization Expression

The synchonization expression does the same as it does in Java (see Java Language Specification). The only difference is that in SARL it is an expression and can therefore be used at more places.

##1. Standard Syntax

The synchronization statement can be used as in Java:

var lock = new Object
synchronized (lock) {

##2. Expression Syntax

Because the synchronized keyword is an expression, it is possible to write synchronized code inside another expression.

var lock = new Object
val name = synchronized (lock) { 

##3. Acknowledgements

This documentation is inspired by the documentations from the Xtext and Xtend projects.

##4. Legal Notice

Copyright © 2014-2019 the original authors or authors.

Licensed under the Apache License, Version 2.0; you may not use this file except in compliance with the License. You may obtain a copy of the License.

You are free to reproduce the content of this page on copyleft websites such as Wikipedia.

Generated with the translator 0.10.0.