pthread 的几个结构体

2023-11-14

/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
   This file is part of the GNU C Library.
   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#ifndef _BITS_PTHREADTYPES_H
#define _BITS_PTHREADTYPES_H    1

#include <bits/wordsize.h>

#if __WORDSIZE == 64
# define __SIZEOF_PTHREAD_ATTR_T 56
# define __SIZEOF_PTHREAD_MUTEX_T 40
# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
# define __SIZEOF_PTHREAD_COND_T 48
# define __SIZEOF_PTHREAD_CONDATTR_T 4
# define __SIZEOF_PTHREAD_RWLOCK_T 56
# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
# define __SIZEOF_PTHREAD_BARRIER_T 32
# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
#else
# define __SIZEOF_PTHREAD_ATTR_T 36
# define __SIZEOF_PTHREAD_MUTEX_T 24
# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
# define __SIZEOF_PTHREAD_COND_T 48
# define __SIZEOF_PTHREAD_CONDATTR_T 4
# define __SIZEOF_PTHREAD_RWLOCK_T 32
# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
# define __SIZEOF_PTHREAD_BARRIER_T 20
# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
#endif


/* Thread identifiers.  The structure of the attribute type is not
   exposed on purpose.  */
typedef unsigned long int pthread_t;


typedef union
{
  char __size[__SIZEOF_PTHREAD_ATTR_T];
  long int __align;
} pthread_attr_t;


#if __WORDSIZE == 64
typedef struct __pthread_internal_list
{
  struct __pthread_internal_list *__prev;
  struct __pthread_internal_list *__next;
} __pthread_list_t;
#else
typedef struct __pthread_internal_slist
{
  struct __pthread_internal_slist *__next;
} __pthread_slist_t;
#endif


/* Data structures for mutex handling.  The structure of the attribute
   type is not exposed on purpose.  */
typedef union
{
  struct __pthread_mutex_s
  {
    int __lock;
    unsigned int __count;
    int __owner;
#if __WORDSIZE == 64
    unsigned int __nusers;
#endif
    /* KIND must stay at this position in the structure to maintain
       binary compatibility.  */
    int __kind;
#if __WORDSIZE == 64
    int __spins;
    __pthread_list_t __list;
# define __PTHREAD_MUTEX_HAVE_PREV    1
#else
    unsigned int __nusers;
    __extension__ union
    {
      int __spins;
      __pthread_slist_t __list;
    };
#endif
  } __data;
  char __size[__SIZEOF_PTHREAD_MUTEX_T];
  long int __align;
} pthread_mutex_t;

typedef union
{
  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
  int __align;
} pthread_mutexattr_t;


/* Data structure for conditional variable handling.  The structure of
   the attribute type is not exposed on purpose.  */
typedef union
{
  struct
  {
    int __lock;
    unsigned int __futex;
    __extension__ unsigned long long int __total_seq;
    __extension__ unsigned long long int __wakeup_seq;
    __extension__ unsigned long long int __woken_seq;
    void *__mutex;
    unsigned int __nwaiters;
    unsigned int __broadcast_seq;
  } __data;
  char __size[__SIZEOF_PTHREAD_COND_T];
  __extension__ long long int __align;
} pthread_cond_t;

typedef union
{
  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
  int __align;
} pthread_condattr_t;


/* Keys for thread-specific data */
typedef unsigned int pthread_key_t;


/* Once-only execution */
typedef int pthread_once_t;


#if defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Data structure for read-write lock variable handling.  The
   structure of the attribute type is not exposed on purpose.  */
typedef union
{
# if __WORDSIZE == 64
  struct
  {
    int __lock;
    unsigned int __nr_readers;
    unsigned int __readers_wakeup;
    unsigned int __writer_wakeup;
    unsigned int __nr_readers_queued;
    unsigned int __nr_writers_queued;
    int __writer;
    int __shared;
    unsigned long int __pad1;
    unsigned long int __pad2;
    /* FLAGS must stay at this position in the structure to maintain
       binary compatibility.  */
    unsigned int __flags;
  } __data;
# else
  struct
  {
    int __lock;
    unsigned int __nr_readers;
    unsigned int __readers_wakeup;
    unsigned int __writer_wakeup;
    unsigned int __nr_readers_queued;
    unsigned int __nr_writers_queued;
    /* FLAGS must stay at this position in the structure to maintain
       binary compatibility.  */
    unsigned char __flags;
    unsigned char __shared;
    unsigned char __pad1;
    unsigned char __pad2;
    int __writer;
  } __data;
# endif
  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
  long int __align;
} pthread_rwlock_t;

typedef union
{
  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
  long int __align;
} pthread_rwlockattr_t;
#endif


#ifdef __USE_XOPEN2K
/* POSIX spinlock data type.  */
typedef volatile int pthread_spinlock_t;


/* POSIX barriers data type.  The structure of the type is
   deliberately not exposed.  */
typedef union
{
  char __size[__SIZEOF_PTHREAD_BARRIER_T];
  long int __align;
} pthread_barrier_t;

typedef union
{
  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
  int __align;
} pthread_barrierattr_t;
#endif


#if __WORDSIZE == 32
/* Extra attributes for the cleanup functions.  */
# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
#endif

#endif    /* bits/pthreadtypes.h */

这些结构体的是在 /usr/include/bits/pthreadtypes.h 中定义。


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

pthread 的几个结构体 的相关文章

随机推荐

  • C语言结构体应用-通讯录

    这里写目录标题 总体介绍 一 数据的定义及数据初始化 二 增加联系人 三 删除联系人 四 修改某个联系人 五 显示所有联系人 六 删除所有联系人 七 按名字首字母排序联系人 八 查找联系人 九 代码展示 总体介绍 本文主要介绍一个结构体的应
  • vue 点击事件失效

    点击事件失效的情况 总共有三种 1 没有点到那个元素 比如说div gt span 事件绑定在div上 但是它可能点来点去是在span标签上面 这种情况 把 click点击事件绑定到span上测试一下就好了 如果是被覆盖了 加个这个 sto
  • error while loading shared libraries: libcublasLt.so.11 解决方法

    在运行cuda程序的时候 有时候会遇到此类错误 error while loading shared libraries libcublasLt so 11 问题是两个 确实没有此类库文件 有此库文件 不过没有放在正确的地方 针对第一类 如
  • Java实现将JSON文件导出到Excel

    文章目录 一 运行环境 二 需求描述 三 实现思路 四 实现代码 一 运行环境 windows10 IDEA 2022 JDK 8 Maven 3 8 6 Apache POI 5 fastjson2 二 需求描述 写一个功能 任意json
  • 利用Vulnhub复现漏洞 - Adobe ColdFusion 反序列化漏洞(CVE-2017-3066)

    Adobe ColdFusion 反序列化漏洞 CVE 2017 3066 Vulnhub官方复现教程 漏洞原理 复现漏洞 启动环境 漏洞复现 生成POC 发送POC 发送POC内容 检验POC 进入容器 通过DockerID进入容器 查看
  • 软工实践2019——第二次作业评分

    第二次作业评分 第二次作业原文 写在前面的话 看了大家陆续提交的第一次作业 感慨良多 初心 勇气和信心 回顾初心 回想自己当初为什么报这个专业 不知你们是否看过电影 无问西东 其中有一句台词 如果提前了解了你们要面对的人生 不知你们是否还会
  • VirtualBox中安装Android-x86详解

    1 下载安装VirtualBox 官网 http www virtualbox org wiki Downloads 2 下载Android x86 官网 http www android x86 org download 这里我们下载5
  • 19. 第三方库的管理和虚拟环境

    Hi 大家好 我是茶桁 在我们之前的课程中 讲解了数据 函数 类 模块以及包 这些基本上已经构成了Python的全部了 那么 我们在学习Python的包之后 有没有思考过 既然Python有内置模块 我们也可以自己写一些模块来使用 那一定有
  • 3D游戏设计作业10:AR/MR 技术

    AR MR 技术 游戏截图 1 作业要求 1 图片识别与建模 2 虚拟按键小游戏 2 设计思路 1 首先是要安装Vuforia 这里直接在file build settings player settings里勾选Vuforia Augme
  • 【漏洞复现】CVE-2021-32682 elFinder ZIP 参数与任意命令注入

    1 Vulhub启动环境 2 查看端口号 3 输入网址 ip 8080 打开网页 4 先创建一个普通的文本文件1 txt 5 然后右键这个文件 对其进行打包 打包后的文件命名为2 zip 并同时进行抓包 获取1 txt的base64编码 6
  • 成员变量与局部变量

    一 成员变量 在类中定义 用来描述对象将要有什么 二 局部变量 在类的方法中定义 在方法中临时保存数据 三 成员变量和局部变量的区别 1 作用域不同 局部变量的作用域仅限于定义它的方法 成员变量的作用域在整个类内部都是可见的 2 初始值不同
  • 【总结】爬虫流程

    爬虫流程 根据所需数据确定爬虫网页 首先考虑resquests 需要提前导入 1 若是文本数据 用response text 2 若是下载视频 图片 音频 用response content 3 若是json接口 用response jso
  • CSS整体界面设计

  • RBAC简介

    RBAC BAC基于角色的访问控制 RBAC认为权限授权的过程可以抽象地概括为 Who是否可以对What进行How的访问操作 RBAC简介 基于角色的权限访问控制模型 在RBAC模型里面 有3个基础组成部分 分别是 用户 角色和权限 RBA
  • Java多线程异常处理

    文章目录 一 线程中出现异常的处理 1 线程出现异常的默认行为 2 setUncaoughtExceptionHandler 方法处理异常 3 setDefaultUncaoughtExceptionHandler 方法进行异常处理 二 线
  • vue3.0的安装配置(含node和npm的配置)

    文章目录 一 下载Node js 二 配置环境变量 三 配置NPM下载存放目录 文件不用事先创建 四 NPM设置镜像仓库 淘宝镜像仓库 五 vue cli脚手架创建Vue3 0项目 一 下载Node js 下载地址 二 配置环境变量 在CM
  • SpringBoot自定义错误页面 与 全局异常处理

    Springboot中需要自定义错误页面 一 使用Springboot默认的配置 1 在templates下穿件一个目录 error 2 在error目录下创建相应的对应的文件即可 如 400 html 500 html 二 自定义错误页面
  • 南大和中大“合体”拯救手残党:基于GAN的PI-REC重构网络,终于有救了

    对于喜欢画画的你来说 总是画得七零八落 不堪入目 但现在 有一种方法可以让你像专业人士那样 让你的糟糕画作变成一副完美的作品 南京大学和中山大学的三位研究人员发布的最新论文中 提出了一种具有边缘和色域的渐进式图像重构网络 PI REC 这是
  • 系统辨识——最小二乘法

    基本原理 数学推导 最小二乘法是通过输入数据与输出数据来拟合已知结构的函数关系 也就是说已知二者的函数关系 通过最小二乘法估计函数的相关参数 假设 x y x y x y存在以下函数关系 但是在实际中 测量数据时存在测量误差或者噪声影响 故
  • pthread 的几个结构体

    Copyright C 2002 2003 2004 2005 2006 2007 Free Software Foundation Inc This file is part of the GNU C Library Contribute