Skip to content
This repository was archived by the owner on Apr 22, 2026. It is now read-only.

Latest commit

 

History

History
59 lines (34 loc) · 1.29 KB

File metadata and controls

59 lines (34 loc) · 1.29 KB

Hooks - more complex customization


  1. General information

1 - General information

You can adjust the "thread" even more flexible with "hooks". It is a few methods in AzaThread, which are called in a variety of situations. And you can override them to perform any special functionality.

class ExampleThread extends Thread
{
	function process()
	{
		// ...
	}

	protected function onLoad()
	{
		// ...
	}
}
onLoad

Hook called after thread initialization, but BEFORE forking!

onFork

Hook called after thread forking (only in child process). Use this if you need to initialize something in child process and do it only once.

It's already called after initialization in synchronous fallback mode!

onShutdown

Hook called before shutdown (only in child process). Use it if you need to do something before the end of the child process.

onCleanup

Called in child and parent processes during the full resources cleanup. Use it if you need to close/cleanup something.