When using print() to debug on smp, it is very annoying to get interleaved output. Fix by wrapping stdout with a fake stream that has a line buffer for each thread.
13 lines
264 B
C++
13 lines
264 B
C++
/*
|
|
* Copyright (C) 2015 Cloudius Systems, Ltd.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdio.h>
|
|
|
|
// Returns a FILE* that writes all its output to @out, but attempts
|
|
// not to mix lines if multiple threads write to it simultaenously.
|
|
FILE* smp_synchronize_lines(FILE* out);
|
|
|