Re: What is __thread tls?

看板DFBSD_kernel作者時間21年前 (2005/03/15 10:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/8 (看更多)
On Mon, 14 Mar 2005, Matthew Dillon wrote: [cut] > :I was under the impression that each pthread has its own errno??? Perhaps > :I am not understanding the context. I'm writing my first threaded > :application so I had best get this straight sooner rather than later. > : > :-Zera > > yup, you are right... see if you can figure out how errno is defined > for a threaded program in the current environment. Hint: it isn't a > simple global declaration. #define errno (* __error()) /* errno.h */ For threaded applications (per the comment): The function __error() returns a pointer to a field "error" in the pthread structure (on line 712 of pthread_private.h). Otherwise and for the main thread: __error() is a pointer to a global variable. If I'm right, then that's pretty cool! :) -Zera > -Matt > Matthew Dillon > <dillon@backplane.com> >
文章代碼(AID): #12Daag00 (DFBSD_kernel)
文章代碼(AID): #12Daag00 (DFBSD_kernel)