Path: blob/main/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_dispatch_defs.h
35269 views
//===-- tsan_dispatch_defs.h ------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of ThreadSanitizer (TSan), a race detector.9//10//===----------------------------------------------------------------------===//11#ifndef TSAN_DISPATCH_DEFS_H12#define TSAN_DISPATCH_DEFS_H1314#include "sanitizer_common/sanitizer_internal_defs.h"1516typedef struct dispatch_object_s {} *dispatch_object_t;1718#define DISPATCH_DECL(name) \19typedef struct name##_s : public dispatch_object_s {} *name##_t2021DISPATCH_DECL(dispatch_queue);22DISPATCH_DECL(dispatch_source);23DISPATCH_DECL(dispatch_group);24DISPATCH_DECL(dispatch_data);25DISPATCH_DECL(dispatch_semaphore);26DISPATCH_DECL(dispatch_io);2728typedef void (*dispatch_function_t)(void *arg);29typedef void (^dispatch_block_t)(void);30typedef void (^dispatch_io_handler_t)(bool done, dispatch_data_t data,31int error);3233typedef long dispatch_once_t;34typedef __sanitizer::u64 dispatch_time_t;35typedef int dispatch_fd_t;36typedef unsigned long dispatch_io_type_t;37typedef unsigned long dispatch_io_close_flags_t;3839extern "C" {40void *dispatch_get_context(dispatch_object_t object);41void dispatch_retain(dispatch_object_t object);42void dispatch_release(dispatch_object_t object);4344extern const dispatch_block_t _dispatch_data_destructor_free;45extern const dispatch_block_t _dispatch_data_destructor_munmap;46} // extern "C"4748#define DISPATCH_DATA_DESTRUCTOR_DEFAULT nullptr49#define DISPATCH_DATA_DESTRUCTOR_FREE _dispatch_data_destructor_free50#define DISPATCH_DATA_DESTRUCTOR_MUNMAP _dispatch_data_destructor_munmap5152#if __has_attribute(noescape)53# define DISPATCH_NOESCAPE __attribute__((__noescape__))54#else55# define DISPATCH_NOESCAPE56#endif5758// Data types used in dispatch APIs59typedef unsigned long size_t;60typedef unsigned long uintptr_t;61typedef __sanitizer::s64 off_t;62typedef __sanitizer::u16 mode_t;63typedef long long_t;6465#endif // TSAN_DISPATCH_DEFS_H666768