Another try at removing the "Last message repeated 1 times.", this time with locking.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17099 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2006-04-11 21:11:50 +00:00
parent a5a38476ea
commit 2f5143505b

View File

@ -826,16 +826,22 @@ static void
flush_pending_repeats(void) flush_pending_repeats(void)
{ {
if (sMessageRepeatCount > 0) { if (sMessageRepeatCount > 0) {
char temp[128]; int32 length;
int32 length = snprintf(temp, sizeof(temp),
"Last message repeated %ld times.\n", sMessageRepeatCount); if (sMessageRepeatCount > 1) {
length = snprintf(sOutputBuffer, OUTPUT_BUFFER_SIZE,
"Last message repeated %ld times.\n", sMessageRepeatCount);
} else {
// if we only have one repeat just reprint the buffer
length = strlen(sOutputBuffer);
}
if (sSerialDebugEnabled) if (sSerialDebugEnabled)
arch_debug_serial_puts(temp); arch_debug_serial_puts(sOutputBuffer);
if (sSyslogOutputEnabled) if (sSyslogOutputEnabled)
syslog_write(temp, length); syslog_write(sOutputBuffer, length);
if (sBlueScreenEnabled || sDebugScreenEnabled) if (sBlueScreenEnabled || sDebugScreenEnabled)
blue_screen_puts(temp); blue_screen_puts(sOutputBuffer);
sMessageRepeatCount = 0; sMessageRepeatCount = 0;
} }
@ -845,13 +851,18 @@ flush_pending_repeats(void)
static status_t static status_t
check_pending_repeats(void *data) check_pending_repeats(void *data)
{ {
cpu_status state;
while (true) { while (true) {
if (sMessageRepeatCount > 0 if (sMessageRepeatCount > 0
&& (system_time() - sMessageRepeatTime) > 1000000) && (system_time() - sMessageRepeatTime) > 1000000) {
cpu_status state = disable_interrupts();
acquire_spinlock(&sSpinlock);
flush_pending_repeats(); flush_pending_repeats();
release_spinlock(&sSpinlock);
restore_interrupts(state);
}
snooze(1000000); snooze(1000000);
} }