Commit Graph

134 Commits

Author SHA1 Message Date
DeidaraMC
154059468e fix: server has no tick catch up limit 2024-03-30 23:04:56 -04:00
DeidaraMC
d04e9e3e71
feat: improve server ticking accuracy, transition to Thread#sleep and… (#2054)
* feat: improve server ticking accuracy, transition to Thread#sleep and compensate for ticks that take too long

* feat: use nano time instead of milliseconds and add compensation for the rare case of the server oversleeping
2024-03-27 03:14:40 -04:00
Steank
2ff143a61d
Fix potential threading bug in Acquirable (#2013)
* Fix potential lock acquisition in Acquirable API

 * Calls to Acquirable#sync(Consumer) will now always unlock, even if the consumer throws an unchecked exception

* fix: formatting

---------

Co-authored-by: Matt Worzala <35708499+mworzala@users.noreply.github.com>
2024-03-05 19:27:56 +00:00
mworzala
ef0daa08bb chore: field reordering
(cherry picked from commit 2b0737615f8171a0172ba902786da0542f962d78)
(cherry picked from commit a032bc32a7)
2024-02-09 14:27:43 -05:00
bea4dev
7cbce377a7 fix Low accuracy tick rate
(cherry picked from commit ce9d254a23791403a2b19ee4bb6bb52e175fa5dd)
(cherry picked from commit 4e33a5e6d8)
2024-02-09 14:27:43 -05:00
mworzala
e2fdce0880 hollow-cube/tick-thread-counter
Signed-off-by: mworzala <mattheworzala@gmail.com>

Add a tick counter in the current tick thread and a way to get the current tick thread.

(cherry picked from commit 65ff64658efef55ac04053dc653fff492cc38a55)
(cherry picked from commit 72a456eea8)
2024-02-09 14:27:43 -05:00
TheMode
8d7175af73
Replace thread locals to pool (#1079) 2022-05-16 07:34:47 +02:00
themode
edabb19891 Explicit fences 2022-03-25 10:12:04 +01:00
themode
b43c404ed2 Never-mind 2022-03-04 05:33:46 +01:00
themode
ad3e723437 CAS to reset acquiring time 2022-03-04 05:31:50 +01:00
themode
d7af91b603 Reduce field lookup 2022-02-23 04:10:34 +01:00
themode
6ef04ae618 Add assert for tick park 2022-02-20 17:44:22 +01:00
themode
ab2fee2bac Synchronize updateAndAwait 2022-02-13 19:36:29 +01:00
themode
2608071ee4 Use method reference to create tick threads 2022-02-13 18:11:15 +01:00
themode
36c27cbe05 Fix rare case where the phaser gets terminated on ARM cpus 2022-02-13 15:52:01 +01:00
TheMode
0934c8ef16 counter thread provider should never update partitions
Signed-off-by: TheMode <themode@outlook.fr>
2022-02-05 06:17:04 +01:00
themode
8778e32700 Extract constant tick time 2022-01-21 10:10:24 +01:00
themode
ae377307c7 unused constructors 2022-01-21 09:53:26 +01:00
TheMode
e979d71dee Update & test acquirable api
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-17 14:24:37 +01:00
TheMode
2ef1902664 Remove MinestomThreadPool, use the common pool for generation
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-12 22:37:35 +01:00
themode
d7d6721474 Better names 2022-01-12 12:02:20 +01:00
themode
1eb5c8519d Fix chunks not being GCed 2022-01-12 11:59:42 +01:00
TheMode
5bbf4642e8 Server process (#550) 2022-01-10 16:51:21 +01:00
TheMode
da69526f49 Dispatcher testing (#570) 2022-01-10 16:51:21 +01:00
themode
5d78a5d996 Real fix 2022-01-10 16:51:21 +01:00
themode
660994443b Fix MinestomThread local cache 2022-01-10 16:51:21 +01:00
themode
b17c66e339 Improve thread dispatcher update 2022-01-10 16:51:21 +01:00
TheMode
bf5c5aa479 Improve thread provider for chunk & instance
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-17 23:49:47 +01:00
TheMode
0f4698bed7 Potentially fix removed entities from still being ticked
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-11 23:38:32 +02:00
TheMode
9fe3f28497 Improve ThreadLocal performance when calling from a minestom thread
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-25 19:37:14 +02:00
themode
1d8addaea6 Prevent TickThreads from stopping if something weird happens 2021-09-21 21:31:02 +02:00
TheMode
860c6b21d1 Remove threadChunkMap
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 13:31:45 +02:00
TheMode
2589cc4f3e Inline TickThread tick method
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 06:21:45 +02:00
TheMode
aa33e2256c Remove useless map lookup
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 17:45:09 +02:00
TheMode
0e8c07a811 Simplify ThreadDispatcher even further
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 17:33:01 +02:00
TheMode
7f463cdf94 Cleanup
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 14:54:11 +02:00
TheMode
a0c38b94c6 Avoid unnecessary thread local lookup for acquirable entities
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 14:41:01 +02:00
TheMode
8fce62ccba Simplify tick loop
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-14 04:36:10 +02:00
TheMode
527141df74 Nvm, the barrier is not necessary
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 23:44:53 +02:00
TheMode
ecd2200e1a Insert barrier
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 23:22:32 +02:00
TheMode
d9c32fe198 Improve TickThread
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 23:20:22 +02:00
TheMode
06d8586f7f Improve the thread provider api
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 22:55:37 +02:00
TheMode
42f4678db0 More style
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-11 06:13:48 +02:00
TheMode
0f2d850dce More Throwable handling
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-01 17:15:49 +02:00
TheMode
91a01a23b6 Use for-each instead of lambda 2021-07-15 20:09:13 +02:00
TheMode
9db185f8a1 Catch exceptions in instance/chunk/entity ticks 2021-07-11 16:56:27 +02:00
TheMode
b546a873e3 Remove unnecessary cast 2021-07-09 11:23:18 +02:00
TheMode
37ab206cb1 ThreadProvider cleanup 2021-07-09 11:20:49 +02:00
TheMode
2e8b3477bf Improve tick scheduling 2021-07-01 00:34:58 +02:00
TheMode
997e35459e Do not use the thread as blocker 2021-06-30 23:34:21 +02:00