/* Method: Magick.set_monitor(&monitor) Purpose: Establish MagickMonitor exit Notes: use nil argument to turn off monitoring */ static VALUE Magick_set_monitor(VALUE class, VALUE monitor) { // 1st time: establish ID, define @@__MAGICK_MONITOR__ // class variable, stow monitor VALUE in it. if (!Magick_Monitor) { Magick_Monitor = rb_intern(MAGICK_MONITOR_CVAR); rb_define_class_variable(Module_Magick, MAGICK_MONITOR_CVAR, monitor); #if defined(HAVE_SETIMAGEPROGRESSMONITOR) rb_warning("Magick.set_monitor is deprecated; use Image#monitor= or Image::Info#monitor= instead."); #endif } // If nil, turn off monitoring. if (monitor == Qnil) { (void) SetMonitorHandler(NULL); } else // Otherwise, store monitor in @@__MAGICK_MONITOR__ { // 1.8.0 deletes rb_cvar_declare and adds another // parm to rb_cvar_set - if rb_cvar_declare is // available, use the 3-parm version of rb_cvar_set. RUBY18(rb_cvar_set(Module_Magick, Magick_Monitor, monitor, 0);) RUBY16(rb_cvar_set(Module_Magick, Magick_Monitor, monitor);) (void) SetMonitorHandler(&monitor_handler); } return class; }