I have a class that accesses the service layer of my application. This class is a singleton. Through the service, it accesses the data evenly, so that my application has the expected behavior. The problem is, I see the need for my class to also be a thread. Does that make sense to you? Thanks
class envio_massa extends Thread {
// atributos
private static $instance = NULL;
// construtor
private static function __construct() {
;
}
// funções
// singleton
public static function get_instance() {
// Já existe uma instância
if (self::$instance == NULL) {
self::$instance = new envio_campanha_service();
}
return self::$instance;
}
// Previne o uso de clone
private function __clone() {}
public function run() {...}
}