鍍金池/ 問答/C  Linux/ #define __ONCE_ALIGNMENT的作用是什么?

#define __ONCE_ALIGNMENT的作用是什么?

在pthread源碼中x86_64-linux-gnu/bits/pthreadtypes.h

typedef int __ONCE_ALIGNMENT pthread_once_t;

__ONCE_ALIGNMENTx86_64-linux-gnu/bits/pthreadtypes-arch.h中定義:

#define __ONCE_ALIGNMENT

我很疑惑這里的__ONCE_ALIGNMENT的作用? 還望各位大神解答!先提前表示感謝!!!

?。ǎā     。撸? ?。埽埽撸А ?, ,\
  /\?。。В撸摺。觥。??。ǎ摺。  。  。ⅰ   ∠到y(tǒng): 4.9.0-kali4-amd64 Debian x86_64 GNU/Linux
  )?。撸摺 。摺。??。В堋。埽ā。。ā?  ?。ВА。ВВ埽堋。埽?/code>
回答
編輯回答
純妹

glibc/sysdeps/nptl/bits/thread-shared-types.h :

       The additional macro defines any constraint for the lock alignment
       inside the thread structures:
    
       __LOCK_ALIGNMENT - for internal lock/futex usage.
    
       Same idea but for the once locking primitive:
    
       __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition.

glibc/sysdeps/nptl/bits/pthreadtypes.h

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

Maybe just an once_flag in threads call_once functions. (*~?ω?)~

2017年4月21日 23:54