Date: Thu, 24 Feb 2005 19:15:44 -0700 (MST) From: "M. Warner Losh" <imp@bsdimp.com> To: river_robert@yahoo.com.cn Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: "sleep" "select" system call not work correctly when linkingwith multithread libray--FreeBSD 4.5 Message-ID: <20050224.191544.01024892.imp@bsdimp.com> In-Reply-To: <200502250205.j1P25hEU004737@rover.village.org> References: <200502250205.j1P25hEU004737@rover.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <200502250205.j1P25hEU004737@rover.village.org> "River" <river_robert@yahoo.com.cn> writes: : Many thanks for your reply. Did the lastest FreeBSD fix this bug? : And which version? I believe that 5 fixes this bug, or at least mostly fixes things (since there's at least one pthread API that uses absolute time). However, I've not verified this on 5. : Because our OS is based on FreeBSD 4.5 and can not port to other : FreeBSD easily, Any method to fix it in 4.5? Thanks. The only fix that I could come up with was to base everything on uptime rather than system time. However, I ran into snags because the pthread's API is stupid: int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime); abstime is lame, because it doesn't cope well with system time changing. Your best bet is to make sure that the system time doesn't step after your application starts. This means you'll likely need to wait for ntpd to step the time, or use ntpdate to get things close and tell ntpd not to step things. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050224.191544.01024892.imp>