ClickHouse/dbms/src/IO/AIO.h
proller a31adcfdea Allow use unbundled cpuid (#2543)
* Wait test server startup for 5s

* clean

* Allow use system libcpuid

* cpuid: move include/cpuid/ -> include/libcpuid/

* fix
2018-06-21 20:35:03 +03:00

41 lines
930 B
C++

#pragma once
#if !(defined(__FreeBSD__) || defined(__APPLE__) || defined(_MSC_VER))
/// https://stackoverflow.com/questions/20759750/resolving-redefinition-of-timespec-in-time-h
#define timespec linux_timespec
#define timeval linux_timeval
#define itimerspec linux_itimerspec
#define sigset_t linux_sigset_t
#include <linux/aio_abi.h>
#undef timespec
#undef timeval
#undef itimerspec
#undef sigset_t
/** Small wrappers for asynchronous I/O.
*/
int io_setup(unsigned nr, aio_context_t * ctxp);
int io_destroy(aio_context_t ctx);
/// last argument is an array of pointers technically speaking
int io_submit(aio_context_t ctx, long nr, struct iocb * iocbpp[]);
int io_getevents(aio_context_t ctx, long min_nr, long max_nr, io_event * events, struct timespec * timeout);
struct AIOContext : private boost::noncopyable
{
aio_context_t ctx;
AIOContext(unsigned int nr_events = 128);
~AIOContext();
};
#endif