(root)/
gcc-13.2.0/
libsanitizer/
tsan/
tsan_dispatch_defs.h
       1  //===-- tsan_dispatch_defs.h ------------------------------------*- C++ -*-===//
       2  //
       3  // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
       4  // See https://llvm.org/LICENSE.txt for license information.
       5  // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
       6  //
       7  //===----------------------------------------------------------------------===//
       8  //
       9  // This file is a part of ThreadSanitizer (TSan), a race detector.
      10  //
      11  //===----------------------------------------------------------------------===//
      12  #ifndef TSAN_DISPATCH_DEFS_H
      13  #define TSAN_DISPATCH_DEFS_H
      14  
      15  #include "sanitizer_common/sanitizer_internal_defs.h"
      16  
      17  typedef struct dispatch_object_s {} *dispatch_object_t;
      18  
      19  #define DISPATCH_DECL(name) \
      20    typedef struct name##_s : public dispatch_object_s {} *name##_t
      21  
      22  DISPATCH_DECL(dispatch_queue);
      23  DISPATCH_DECL(dispatch_source);
      24  DISPATCH_DECL(dispatch_group);
      25  DISPATCH_DECL(dispatch_data);
      26  DISPATCH_DECL(dispatch_semaphore);
      27  DISPATCH_DECL(dispatch_io);
      28  
      29  typedef void (*dispatch_function_t)(void *arg);
      30  typedef void (^dispatch_block_t)(void);
      31  typedef void (^dispatch_io_handler_t)(bool done, dispatch_data_t data,
      32                                        int error);
      33  
      34  typedef long dispatch_once_t;
      35  typedef __sanitizer::u64 dispatch_time_t;
      36  typedef int dispatch_fd_t;
      37  typedef unsigned long dispatch_io_type_t;
      38  typedef unsigned long dispatch_io_close_flags_t;
      39  
      40  extern "C" {
      41  void *dispatch_get_context(dispatch_object_t object);
      42  void dispatch_retain(dispatch_object_t object);
      43  void dispatch_release(dispatch_object_t object);
      44  
      45  extern const dispatch_block_t _dispatch_data_destructor_free;
      46  extern const dispatch_block_t _dispatch_data_destructor_munmap;
      47  } // extern "C"
      48  
      49  #define DISPATCH_DATA_DESTRUCTOR_DEFAULT nullptr
      50  #define DISPATCH_DATA_DESTRUCTOR_FREE    _dispatch_data_destructor_free
      51  #define DISPATCH_DATA_DESTRUCTOR_MUNMAP  _dispatch_data_destructor_munmap
      52  
      53  #if __has_attribute(noescape)
      54  # define DISPATCH_NOESCAPE __attribute__((__noescape__))
      55  #else
      56  # define DISPATCH_NOESCAPE
      57  #endif
      58  
      59  #if SANITIZER_APPLE
      60  # define SANITIZER_WEAK_IMPORT extern "C" __attribute((weak_import))
      61  #else
      62  # define SANITIZER_WEAK_IMPORT extern "C" __attribute((weak))
      63  #endif
      64  
      65  
      66  // Data types used in dispatch APIs
      67  typedef unsigned long size_t;
      68  typedef unsigned long uintptr_t;
      69  typedef __sanitizer::s64 off_t;
      70  typedef __sanitizer::u16 mode_t;
      71  typedef long long_t;
      72  
      73  #endif  // TSAN_DISPATCH_DEFS_H