Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unregistering a callback registered via register_callback()?

Tags:

c++

iostream

I'm using register_callback() to register a call-back function for iostreams as described in Standard C++ IOStreams and Locales, p. 202.

However, neither it nor any documentation I could find say how one can unregister a call-back. Is it possible? If I were to zero-out the iword/pword I'm using, is unregistering even necessary?

like image 830
Paul J. Lucas Avatar asked Mar 08 '12 15:03

Paul J. Lucas


1 Answers

The register_callback function registers your callback for a specific stream object. The way to get rid of the registration is to let the stream go out of scope.

If you need your callback to do its work for just a part of the stream's lifetime, you can store that condition with the callback and make it do nothing.

Clearing iword/pword doesn't help (except that it could be a signal to the callback to do nothing), and there is no way to unregister.

like image 190
Bo Persson Avatar answered Nov 17 '22 21:11

Bo Persson