tamerlib/tests/worker.php

18 lines
575 B
PHP
Raw Permalink Normal View History

2023-06-16 02:07:36 -04:00
<?php
// Import everything
2023-06-16 02:07:36 -04:00
require 'ncc';
require __DIR__ . DIRECTORY_SEPARATOR . 'ExampleClass.php';
import('net.nosial.tamerlib');
// Initialize TamerLib
2023-06-16 03:38:51 -04:00
\TamerLib\tm::initialize(\TamerLib\Enums\TamerMode::WORKER);
2023-06-16 02:07:36 -04:00
// Register the functions
2023-06-16 02:07:36 -04:00
$example_class = new ExampleClass();
\TamerLib\tm::addFunction('sleep', [$example_class, 'sleep']);
\TamerLib\tm::addFunction('pi', [$example_class, 'pi']);
\TamerLib\tm::addFunction('throwException', [$example_class, 'throwException']);
2023-06-16 02:07:36 -04:00
// Run the worker
\TamerLib\tm::run();