Skip to content

Instantly share code, notes, and snippets.

@A248
Created August 13, 2020 19:17
Show Gist options
  • Save A248/5c43c0c68664a3c79b8332caf4013302 to your computer and use it in GitHub Desktop.
Save A248/5c43c0c68664a3c79b8332caf4013302 to your computer and use it in GitHub Desktop.

Synchronised. You probably hear that word a lot. However, be careful, because it can mean different things depending on the context.

First, "synchronized" is a Java keyword, which relates to "synchronized blocks." This is what online tutorials will tell you about and it is mostly what synchronized means in Java. The synchronised keyword is a means of achieving mutual exclusion, that is, preventing concurrent access to shared data.

Second, "synchronised" can refer to a "main thread." In this regard, "synchronise to the main thread" and "execute a synchronised task" both mean "execute a task on the main thread".

Third, "sync" means "synchronised" - sync is just an abbreviation of synchronised. However, in casual Bukkit speak, "sync" also means "on the main thread." To run something "sync" means to run it on the main thread, to run something "async" means off the main thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment