[PR #372] [MERGED] Moved main loop into FixedRate scheduler. Added sync lock on runnable. #9598

Closed
opened 2026-06-02 12:22:10 +00:00 by Dark98 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/2006-Scape/2006Scape/pull/372
Author: @DamionDamion
Created: 2/9/2020
Status: Merged
Merged: 2/10/2020
Merged by: @dginovker

Base: masterHead: fixedratetickloop


📝 Commits (6)

📊 Changes

1 file changed (+66 additions, -36 deletions)

View changed files

📝 2006Redone Server/src/com/rebotted/GameEngine.java (+66 -36)

📄 Description

Previous the main while{} loop featured a Thread.Sleep(600). This results in 600ms of unusable CPU time, or a maximum efficiency rate of 30%.

As each invocation is within a Runnable(), a synchronization lock is required to prevent concurrency.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/2006-Scape/2006Scape/pull/372 **Author:** [@DamionDamion](https://github.com/DamionDamion) **Created:** 2/9/2020 **Status:** ✅ Merged **Merged:** 2/10/2020 **Merged by:** [@dginovker](https://github.com/dginovker) **Base:** `master` ← **Head:** `fixedratetickloop` --- ### 📝 Commits (6) - [`3eb6e87`](https://github.com/2006-Scape/2006Scape/commit/3eb6e870192746e822c1321f4792fc0a72ec8cad) Moved main loop into FixedRate scheduler. Added sync lock on runnable. - [`fb1321c`](https://github.com/2006-Scape/2006Scape/commit/fb1321c8e0009dada331a0b9641cd2aec03c6367) Synchronization lock not required for scheduleAtFixedRate(new Runnable(){}) https://stackoverflow.com/a/35498230 - [`00efcbb`](https://github.com/2006-Scape/2006Scape/commit/00efcbbde96c7af9c63beb831fbe01e5846d90a9) Adjust formatting - [`b855a98`](https://github.com/2006-Scape/2006Scape/commit/b855a98842b4172ee74bc3733a4af901de086499) Fix doco - [`b665504`](https://github.com/2006-Scape/2006Scape/commit/b665504c4b20d3874799e3c733f956ea24c96a67) Added block on main thread until tick scheduler shutdown. - [`1d95da8`](https://github.com/2006-Scape/2006Scape/commit/1d95da80b72bb70a9ff661846801dc45e603f15e) Move shutdown call outside for loop. ### 📊 Changes **1 file changed** (+66 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `2006Redone Server/src/com/rebotted/GameEngine.java` (+66 -36) </details> ### 📄 Description Previous the main while{} loop featured a Thread.Sleep(600). This results in 600ms of unusable CPU time, or a maximum efficiency rate of 30%. As each invocation is within a Runnable(), a synchronization lock is required to prevent concurrency. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Dark98 added the pull-request label 2026-06-02 12:22:10 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: 2006-Scape/2006Scape#9598