Re: "sleep" "select" system call not work correctly when linkingwith multithread libray--FreeBSD 4.5
From: M. Warner Losh (imp_at_bsdimp.com)
Date: 02/25/05
- Previous message: M. Warner Losh: "Re: Driver Update Disk discussion"
- Next in thread: River: "Re: Re: "sleep" "select" system call not work correctly when linkingwith multithread libray--FreeBSD 4.5"
- Maybe reply: River: "Re: Re: "sleep" "select" system call not work correctly when linkingwith multithread libray--FreeBSD 4.5"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 24 Feb 2005 19:15:44 -0700 (MST) To: river_robert@yahoo.com.cn
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
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
- Previous message: M. Warner Losh: "Re: Driver Update Disk discussion"
- Next in thread: River: "Re: Re: "sleep" "select" system call not work correctly when linkingwith multithread libray--FreeBSD 4.5"
- Maybe reply: River: "Re: Re: "sleep" "select" system call not work correctly when linkingwith multithread libray--FreeBSD 4.5"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|