On Wed, Feb 27, 2008 at 02:36:14PM -0500, George Nychis wrote:
> Is it possible to cancel a one shot m-block timeout before it occurs, or 
> cancel a periodic timeout before a signal is generated?
>
> I know how to cancel periodic timeouts using a received signal's
> meta-data, but I'm not sure its possible to cancel in these situations.
>
> Thanks!
> George

Hi George,

Just use cancel_timeout.

>From class mb_mblock:

  /*!
   * \brief Schedule a "one shot" timeout.
   *
   * \param abs_time the absolute time at which the timeout should fire
   * \param user_data the data passed in the %timeout message.
   *
   * When the timeout fires, a message will be sent to the mblock.
   *
   * The message will have port_id = %sys-port, signal = %timeout,
   * data = user_data, metadata = the handle returned from
   * schedule_one_shot_timeout, pri = MB_PRI_BEST.
   *
   * \returns a handle that can be used in cancel_timeout, and is passed
   * as the metadata field of the generated %timeout message.
   *
   * To cancel a pending timeout, call cancel_timeout.
   */
  pmt_t
  schedule_one_shot_timeout(const mb_time &abs_time, pmt_t user_data);

  /*!
   * \brief Schedule a periodic timeout.
   *
   * \param first_abs_time The absolute time at which the first timeout should 
fire.
   * \param delta_time The relative delay between the first and successive 
timeouts.
   * \param user_data the data passed in the %timeout message.
   *
   * When the timeout fires, a message will be sent to the mblock, and a
   * new timeout will be scheduled for previous absolute time + delta_time.
   *
   * The message will have port_id = %sys-port, signal = %timeout,
   * data = user_data, metadata = the handle returned from
   * schedule_one_shot_timeout, pri = MB_PRI_BEST.
   *
   * \returns a handle that can be used in cancel_timeout, and is passed
   * as the metadata field of the generated %timeout message.
   *
   * To cancel a pending timeout, call cancel_timeout.
   */
  pmt_t
  schedule_periodic_timeout(const mb_time &first_abs_time,
                            const mb_time &delta_time,
                            pmt_t user_data);

  /*!
   * \brief Attempt to cancel a pending timeout.
   *
   * Note that this only stops a future timeout from firing.  It is
   * possible that a timeout may have already fired and enqueued a
   * %timeout message, but that that message has not yet been seen by
   * handle_message.
   *
   * \param handle returned from schedule_one_shot_timeout or 
schedule_periodic_timeout.
   */
  void cancel_timeout(pmt_t handle);



_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to