This is the mail archive of the libc-help@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]

Re: usleep() can't schedule thread and where is the definition offunction __mach_reply_port?


On 07/10/2012 10:40 AM, Neil wrote:

I meet a problem that on routerstation the main thread call
usleep(100) try to schedule the child thread, but the child thread
doesn't run sometimes. If main thread call usleep(1000) then the child
thread will always scheduled. Does anybody meet this problem before?

This could have to do with scheduler granularity. The kernel probably cannot make it back to the calling code in 100 microseconds if it gives up the current time slice, so it busy-waits instead.


Then I check the usleep() code, find that it calls __nanosleep(). In
__nanosleep(), it seems to call function __mach_reply_port() to handle
the sleep. But I don't find the definition of __mach_reply_port(),
there just a declaration in mach/mach/mach_traps.h.

This looks like the Hurd implementation, not sure if this is the correct implementation in your case. On other systems, nanosleep() is a system call which is implemented in the kernel, not in libc.


--
Florian Weimer / Red Hat Product Security Team



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