Commit 6e546000 authored by Florian Fischer's avatar Florian Fischer
Browse files

don't stop the watch in the signal handler

I don't know how this breaks but stopping the watch in the signal handler
overflows when summing up the clock differences.
parent 5027c53b
......@@ -5,6 +5,7 @@
#include <stdint.h>
#include <stdlib.h>
#include "common.h"
#include "stopwatch.h"
struct aiocb aiocb;
......@@ -12,8 +13,7 @@ struct aiocb aiocb;
atomic_int done;
void callback(int sig, siginfo_t *info, void *context) {
stop_watch();
if (info->si_value.sival_int != 42) errx(EXIT_FAILURE, "got unexpected sigval value");
if (unlikely(info->si_value.sival_int != 42)) errx(EXIT_FAILURE, "got unexpected sigval value");
atomic_store(&done, 1);
}
......@@ -38,9 +38,10 @@ void do_write(int fd, const void *buf, size_t count) {
start_watch();
int res = aio_write(&aiocb);
if (res == -1) err(EXIT_FAILURE, "aio_write failed");
if (unlikely(res == -1)) err(EXIT_FAILURE, "aio_write failed");
while (!atomic_load(&done)) {
}
stop_watch();
atomic_store(&done, 1);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment