All pastes #453893 Raw Edit

Something

public text v1 · immutable
·published 2007-04-23 08:57 UTC
rendered paste body
is it fair to say I don't need to do the P/V stuff on the sputline because it's handled in the sputc?


int sputc(struct stty *tty, int c) 
{
/*(1). wait for room in outbuf[];*/
	P(&tty->outRoom);
/*(2). insert c into outbuf[];NOTE: MUST HANDLE POSSIBLE INTERFERENCE FROM shandler()!*/
	/* disable interrupts */
	lock();
	tty->outbuf[tty->outhead++] = c;
	tty->outhead %= BUFLEN;
	unlock();
/*(3). if TX interrupt is off, turn on TX interrupt (to start output);*/
	enable_tx(tty);
}/**/

int sputline(char* line)
{
	struct stty *tty;
	tty = &stty[0];
	while (*line)
	{
		sputc(tty, *line++);
	}/*end while line exists*/
/*(1). one process at a time!*/
/*(2). call sputc() repeatedly to copy chars into outbuf[]*/
/*(3). allow another process*/
}/**/