gpt4 book ai didi

c++ - 当我复制 pthread_rwlock_t 时会发生什么?

转载 作者:太空宇宙 更新时间:2023-11-04 07:41:39 24 4
gpt4 key购买 nike

pthread_rwlock t1;
pthread_rwlock_wrlock(&t1);

pthread_rwlock t2 = t1;

发生了什么事?t2 是否锁定?

最佳答案

没有什么特别的事情发生。 pthread_rwlock_t(不是 pthread_rwlock,AFAIK)是一个不透明的 C 结构。复制变量只是逐字节复制结构。

在 Pthreads 级别,复制 pthread_rwlock_t 会导致未定义的行为。不要这样做。

关于c++ - 当我复制 pthread_rwlock_t 时会发生什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3317167/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com