46 Commits

Author SHA1 Message Date
Dylan K. Taylor
b331f8e1c9 AsyncWorker: added removeFromThreadStore()
and use it instead of overwriting with null things, which still occupies memory
2018-06-07 10:12:50 +01:00
Dylan K. Taylor
ee787974f2 AsyncWorker: Use statics for thread-local worker storage instead of globals 2018-06-07 09:59:32 +01:00
Dylan K. Taylor
81957d133d AsyncTask: Rewrite how thread-local storage works, now non-dependent on Server or ServerScheduler
this implementation was god-awful bad and it was entirely avoidable to make it this complicated.

This utilizes the fact that pthreads treats static properties as thread-local. AsyncTask local storage now utilizes a \SplObjectStorage stored in an AsyncTask private static field.
2018-05-29 19:41:00 +01:00
Dylan K. Taylor
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
Dylan K. Taylor
cd35bd6872 git diff-tree --check $(git hash-object -t tree /dev/null) HEAD 2018-03-11 10:31:25 +00:00
Dylan K. Taylor
18b287c3ea AsyncTask: Remove cleanObject() and calls to it
This is no longer needed. Doing worker GC (via collect()) frees the allocated memory anyway, so this function is now redundant.
2018-01-30 16:45:49 +00:00
Dylan K. Taylor
aaa3b6e59a Added explicit AsyncTask->storeLocal(), removed AsyncTask->__construct() object storage (#1322)
Far too often I see people using IDEs which generate the constructors for them and then accidentally unintentionally store things in the object store. This parent constructor behaviour is unexpected. If a developer wants to store something, they should now do so explicitly by calling storeLocal().
2017-09-10 20:31:28 +01:00
Dylan K. Taylor
8fc1501e89 Moar typehints 2017-07-14 08:52:27 +01:00
Dylan K. Taylor
9c9095060f Register MainLogger on AsyncWorkers to make MainLogger::getLogger() usable in AsyncTasks
Threaded static properties aren't thread-local anymore in pthreads 3.1.7dev
2017-07-04 16:50:17 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
674394c4f5 Fixed undefined offset when retrieving something from the thread store that doesn't exist (#919) 2017-05-22 13:53:57 +08:00
Dylan K. Taylor
00e6d6a6b1 Fixed AsyncTask memory leak (#922)
* Added PocketMine-TesterPlugin submodule with regression test
2017-05-17 15:43:44 +01:00
Sandertv
1c7773c5f1 Visibility keyword before final or abstract keyword. (#814) 2017-04-13 20:58:53 +08:00
Dylan K. Taylor
1cb96d24ce Some fixes, thanks PhpStorm 2017-01-04 11:29:24 +00:00
SOFe
ab4d6b1e36
Clarified that AsyncTask should not run for a long time 2016-11-13 18:14:41 +08:00
SOFe
75fa2f1132
Fixed array progress crashing
Forgot to serialize them. They would be converted to Volatile, which is Threaded. Threaded objects still crash with progressUpdates.
2016-11-12 18:57:52 +08:00
SOFe
d5881dbe83
Disallow Threaded objects to be passed as progress parameter 2016-11-12 18:33:25 +08:00
SOFe
8404ce88bd
Fixed pthreads crashes with progressUpdates 2016-11-12 18:30:55 +08:00
SOFe
e6485c4734
Added AsyncTask progress update API 2016-11-12 17:31:59 +08:00
SOFe
074583d104 Builtin thread-local object storage for AsyncTask (#1)
* Added AsyncTask::fetchLocal()
2016-11-06 22:02:53 +08:00
SOF3
6fc435da0e
Imports rearrangement 2016-10-03 00:43:46 +08:00
Intyre
a2734f6dc0
Merged master into php7 to support 0.13.1 2016-01-22 17:36:45 +01:00
Shoghi Cervantes
0bcf639a98 Changed how exceptions work and are logged, throw proper exceptions on tasks 2015-09-18 12:03:24 +02:00
Shoghi Cervantes
3ffdb8e552 Removed @deprecated classes, methods and properties, added some type hints 2015-09-12 17:10:11 +02:00
Shoghi Cervantes
e137ac4c56 Base PHP7 work to make it "run" - READ NEXT LINES!
All plugins will need to bump the API if they want to use this.
NOTE THAT THIS IS NOT THE FINAL API 2.0.0 AND THAT THERE WILL BE MORE CHANGES.
To start updating, you might also want to read https://secure.php.net/manual/en/migration70.php and specifically https://secure.php.net/manual/en/migration70.incompatible.php

To compile PHP7 with some of the required dependencies, use https://gist.github.com/shoghicp/166ab26ce5cc7a390f45
ONLY LINUX IS TESTED, DO NOT ASK FOR OTHER PLATFORMS!

----- THIS VERSION IS NOT SUPPORTED -----

This version WILL crash randomly in unexpected places due to PHP7, pthreads, PocketMine or cosmic rays.

Handle with care, and store under direct sunlight for the best performance.
2015-09-10 21:29:29 +02:00
Shoghi Cervantes
33e312c7d0
Added extra memory reportings (heap, stack), stop tasks faster, added extra timeouts fro ServerKiller 2015-06-13 15:37:02 +02:00
Shoghi Cervantes
cde2d39029
New statistics system 2015-05-21 11:41:11 +02:00
Shoghi Cervantes
b2c25eaf36
Added MemoryManager, new memory properties, improved performance, updated RakLib, fixed misc. bugs 2015-04-18 20:13:52 +02:00
Shoghi Cervantes
72c4c01542 Yay generation uses async tasks 2015-03-26 18:21:39 +01:00
Shoghi Cervantes
962c28aaca
BatchPacket, compress any packet depending on the size, really fast threaded chunk sending 2015-03-26 00:06:46 +01:00
Shoghi Cervantes
692045d714
Improved threading and resource usage, new defaults 2015-01-02 18:46:39 +01:00
Shoghi Cervantes
9b85abd75e Micro-optimizations 2014-10-15 10:44:01 +02:00
Shoghi Cervantes
7f85e37540 Worked on scheduler 2014-10-11 16:36:38 +02:00
Shoghi Cervantes
baf06dc363 Revert "Use Collectable class on AsyncTask, removed task collection workaround on ServerScheduler"
This reverts commit 0dba14074a634e82539735c3be88c6ae31b0be05.
2014-10-11 00:03:46 +02:00
Shoghi Cervantes
0dba14074a Use Collectable class on AsyncTask, removed task collection workaround on ServerScheduler 2014-10-10 20:53:28 +02:00
Shoghi Cervantes
db7222976e Code cleanup 2014-08-21 17:26:41 +02:00
Shoghi Cervantes
fee7f5060b Made AsyncTask::onCompletion() implementation optional 2014-08-10 18:15:06 +02:00
Shoghi Cervantes
b8802edd6d Only allow one thread per property, fixes #1668 2014-07-17 21:22:48 +02:00
Shoghi Cervantes
6c442551f7 Fixed client crashing (temp.), fixed clients not spawning. (Fixes #1640 #1636 #1590 #1573) 2014-07-14 02:19:14 +02:00
Shoghi Cervantes
22552cdd72 Improved chunk sending, moved chunk encoding and compression to another thread 2014-07-05 20:41:44 +02:00
Shoghi Cervantes
9877271d70 Fixed kick messages 2014-06-25 20:50:16 +02:00
Shoghi Cervantes
80aebf2932 Added AsyncTask::onCompletion() 2014-06-25 13:01:39 +02:00
Shoghi Cervantes
7f795bc041 Fixed #1501 executing AsyncTasks blocks other threads 2014-06-22 12:50:24 +02:00
Shoghi Cervantes
53749483c3 Implemented new Inventory windows on Player, Chest and Furnace 2014-05-23 20:53:06 +02:00
Shoghi Cervantes
80f9093875 Added /reload command (does not reload source code) 2014-04-03 15:49:00 +02:00
Shoghi Cervantes
0f42cd9243 Added Asynchronous tasks, usage sending 2014-04-02 20:20:14 +02:00