/* INTERFACE: Lock message queue and return the pointer to the first entry.  */
diva_dbg_entry_head_t* diva_maint_get_message(word *size, diva_os_spin_lock_magic_t *old_irql)
/* INTERFACE: Lock message queue and return the pointer to the first entry.  */
diva_dbg_entry_head_t* diva_maint_get_message(word *size, diva_os_spin_lock_magic_t *old_irql)
{
  diva_dbg_entry_head_t*     pmsg = NULL;
  diva_os_enter_spin_lock (&dbg_q_lock, old_irql, "read");
  if (dbg_q_busy) {
    diva_os_leave_spin_lock (&dbg_q_lock, old_irql, "read_busy");
    return NULL;
  }
  dbg_q_busy = 1;
  if (!(pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, size))) {
    dbg_q_busy = 0;
    diva_os_leave_spin_lock (&dbg_q_lock, old_irql, "read_empty");
  }
  return (pmsg);
}