Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get with a watcher could not invoke the watcher callback #34

Open
haiwenzhu opened this issue May 7, 2014 · 2 comments
Open

get with a watcher could not invoke the watcher callback #34

haiwenzhu opened this issue May 7, 2014 · 2 comments

Comments

@haiwenzhu
Copy link
Contributor

class ZookeeperDemo extends Zookeeper {

    public function watcher( $i, $type, $key ) { 
        echo "Insider Watcher\n";

        // Watcher gets consumed so we need to set a new one
        $this->get( '/bar', array($this, 'watcher' ) );
    }   

}

$zoo = new ZookeeperDemo('127.0.0.1:2181');
$zoo->set('/bar', 1); 
$zoo->get( '/bar', array($zoo, 'watcher') );

while( true ) { 
    echo '.';
    sleep(2);
}

running this in php-5.5.6 will report a php warning:
PHP Warning: Unknown: could not invoke watcher callback in Unknown on line 0

@haiwenzhu
Copy link
Contributor Author

It seems that php must be thread safety disabled to make wathcer work.
I turned my php from thread safety to no-safety and this problem is fixed.

@Timandes
Copy link
Contributor

Timandes commented May 1, 2018

Would you try new function zookeeper_dispatch()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants