Hi David,
Thanks again for your replies.
I found some other futex_mutex code in frameworks/base/libs/utils/
futex_synchro.c, which does implement timedlock. Do you know why this
code exists and frameworks/base/libs/utils/Threads.cpp is using it
instead of pthreads? Looking at the timedlock implementation, it
doesn't recalculate the relative timeout that gets passed to
__futex_wait()... is this a bug?
Thanks!
-Brad
On Mar 4, 10:00 am, David Turner <
di...@android.com> wrote:
> On Wed, Mar 4, 2009 at 4:46 PM, Brad Larson <
bklar...@gmail.com> wrote:
>
> > Thanks for the reply!
>
> > I've created an issue at
> >
http://code.google.com/p/android/issues/detail?id=2138
>
> > Is there any code I could reference for how pthread_mutex_timedlock()
> > could be implemented? Is the other code in pthread.c based on
> > anything which might also implement timedlock? Or was it all written
> > from scratch?
>
> You will need to start from pthread_lock(), the only trick point should be
> that you'll
> need to compute a relative timeout each time __futex_wait() is called, and
> also check
> for time-outs explicitely before calling it
>
> See __pthread_cond_timedwait() implementation and other sources here:
>
>
http://android.git.kernel.org/?p=platform/bionic.git;a=blob;f=libc/bi...