<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">ZdravÃm, vedel by mi, prosÃm, niekto objasniÅ¥ zopár vecà k téme System calls z OperaÄných systémov? <div><br></div><div>V súbore kernel/proc/sys_thread.c je fukcia sys_thread_join (uintptr_t tid, void **thread_retval), ktorá má spojiÅ¥ thread (join a thread). </div><div><br></div><div>Chápem to tak, že fukcia robà nasledovné:</div><div>// check that the tid pointer points to a safely mapped user memory,</div><div><div><span style="white-space:pre-wrap"> </span>if (tid != NULL && !vma_check_user((void*)tid, sizeof(struct uthread))) {</div><div><span style="white-space:pre-wrap"> </span>return ENOMEM;</div><div><span style="white-space:pre-wrap"> </span>}</div><div>// check whether the requested thread to join is a valid thread of the current process.</div></div><div><div><span style="white-space:pre-wrap"> </span>process_t process = thread_get_process ();</div><div><span style="white-space:pre-wrap"> </span>uthread_t uthread = NULL;</div></div><div><div><span style="white-space:pre-wrap"> </span>/* Disable interrupts while accessing shared structures. */</div><div><span style="white-space:pre-wrap"> </span>ipl_t state = query_and_disable_interrupts ();</div><div>// convert the thread ID to the actual user thread control structure (uthread_t).</div></div><div><div><span style="white-space:pre-wrap"> </span>uthread = (uthread_t)tid;</div><div>// the process control structure (process_t) contains a list of valid user threads.</div><div><span style="white-space:pre-wrap"> </span>conditionally_enable_interrupts (state);</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div>if (uthread == NULL) return EINVAL;</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div>// call the appropriate kernel function</div><div>// vykoná "join a thread"</div><div><span style="white-space:pre-wrap"> </span>return thread_join(uthread->thread, thread_retval);</div></div><div><br></div><div>Mojou otázkou je, Äi je potrebné v tejto fukcià prechádzaÅ¥ zoznam process->uthread_list a porovnaÅ¥, Äi sa uthread nachádza v zozname.</div><div><br></div><div>Äakujem.</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>