1#pragma once
2
3#include <IO/WriteBufferFromFileDescriptor.h>
4
5
6namespace DB
7{
8
9/** Write to file descriptor but drop the data if write would block or fail.
10 * To use within signal handler. Motivating example: a signal handler invoked during execution of malloc
11 * should not block because some mutex (or even worse - a spinlock) may be held.
12 */
13class WriteBufferFromFileDescriptorDiscardOnFailure : public WriteBufferFromFileDescriptor
14{
15protected:
16 void nextImpl() override;
17
18public:
19 using WriteBufferFromFileDescriptor::WriteBufferFromFileDescriptor;
20 ~WriteBufferFromFileDescriptorDiscardOnFailure() override {}
21};
22
23}
24