-/* $OpenBSD: wsdisplay.c,v 1.149 2022/07/15 17:57:27 kettenis Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.150 2022/11/26 06:20:18 anton Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/systm.h>
+#include <sys/task.h>
#include <sys/tty.h>
#include <sys/signalvar.h>
#include <sys/errno.h>
struct wsscreen {
struct wsscreen_internal *scr_dconf;
+ struct task scr_emulbell_task;
+
struct tty *scr_tty;
int scr_hold_screen; /* hold tty output */
int sc_focusidx; /* available only if sc_focus isn't null */
struct wsscreen *sc_focus;
+ struct taskq *sc_taskq;
+
#ifdef HAVE_BURNER_SUPPORT
struct timeout sc_burner;
int sc_burnoutintvl; /* delay before blanking (ms) */
int wsdisplay_activate(struct device *, int);
+void wsdisplay_emulbell_task(void *);
+
struct cfdriver wsdisplay_cd = {
NULL, "wsdisplay", DV_TTY
};
dconf->scrdata = type;
}
+ task_set(&scr->scr_emulbell_task, wsdisplay_emulbell_task, scr);
scr->scr_dconf = dconf;
scr->scr_tty = ttymalloc(0);
scr->sc = sc;
}
(*scr->scr_dconf->wsemul->detach)(scr->scr_dconf->wsemulcookie,
&ccol, &crow);
+ taskq_del_barrier(scr->sc->sc_taskq, &scr->scr_emulbell_task);
free(scr->scr_dconf, M_DEVBUF, sizeof(*scr->scr_dconf));
free(scr, M_DEVBUF, sizeof(*scr));
}
}
#endif
+ taskq_destroy(sc->sc_taskq);
+
return (0);
}
sc->sc_isconsole = console;
sc->sc_resumescreen = WSDISPLAY_NULLSCREEN;
+ sc->sc_taskq = taskq_create(sc->sc_dv.dv_xname, 1, IPL_TTY, 0);
+
if (console) {
KASSERT(wsdisplay_console_initted);
KASSERT(wsdisplay_console_device == NULL);
if (scr->scr_flags & SCR_GRAPHICS) /* can this happen? */
return;
- (void) wsdisplay_internal_ioctl(scr->sc, scr, WSKBDIO_BELL, NULL,
+ task_add(scr->sc->sc_taskq, &scr->scr_emulbell_task);
+}
+
+void
+wsdisplay_emulbell_task(void *v)
+{
+ struct wsscreen *scr = v;
+
+ (void)wsdisplay_internal_ioctl(scr->sc, scr, WSKBDIO_BELL, NULL,
FWRITE, NULL);
}