shithub: plan9front

ref: f1e15da8f550b12196d57e245437251f6eb289b5
dir: /acme/bin/source/acd/outline/

View raw version
acd is composed of four procs

wineventproc (win.c:/^wineventproc)
	reads acme window events, sends them along w->cevent.

cdstatusproc (mmc.c:/^cdstatusproc)
	reads cd status once per second, sending
		status updates to d->cstatus.
	detects disk changes, sends new tocs to d->ctocdisp.

cddbproc (cddb.c:/^cddbproc)
	reads tocs from d->cdbreq, if it finds
		translations in the cddb, sends new tocs to d->cdbreply.

eventwatcher (main.c:/^eventwatcher)
	the main event loop.
		reads status from d->cstatus.
		reads events from w->cevent.
		reads new tocs to display from d->ctocdisp.
		sends new tocs to translate to d->cdbreq.
		reads new translated tocs from d->cdbreply.

an interesting bug in the original design:
	both cdstatusproc and the eventwatcher proc
	issue scsi commands.  (the eventwatcher responds to
	things such as Play, Stop, etc., as well as advancing the track.)

	the sd(3) driver did not expect overlapped commands,
	and crashed.

	this has been fixed by making the scsi(2) commands threadsafe,
	and making the sd(3) driver more robust.