This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

threads.h implementation issues


Hi guys.

I'm still working on the implementation of the C11 threads but now i'm
getting a few doubts on how to do some stuff so I thought that
feedback from you, more experienced fellas, would be really
appreciated. Let's start with it.

- My main problem is with thrd_exit and thrd_join. thrd_exit is
supposed to return an int value that thrd_join can receive if waiting
for that thread to terminate. My question is: If a joined thread calls
thrd_exit, the int value to be returned will be copied in it's
stack.ant then, once it dies, it's completely impossible for the
joiner thread to obtain that value. The same happens with
pthread_exit, but in this case, it returns a void* value, so if the
value to be returned is allocated in heap, there is no problem to
access it later with pthread_join and free that piece of memory.
Anyone can address me or suggest how to solve this?

- Another one is with the mtx_t and cnd_t. The rest of types could be
just copied from the Linux Base Specification for pthreads, so there
won't be namespace issues, but those two are still unclear to me. What
should I do? Rename pthread_cond_t to __pthread_cond_t and
pthread_mutex_t to __pthread_mutex_t and use weak aliases?

- To implement thrd_sleep I'm using nanosleep, that is a syscall, is
that ok to you?

Thanks in advance.
Cheers.

-- 
Juan Manuel "Lolo" Torres Palma.
Computer Science Student at Universidad de Granada.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]