[uClibc] Request for: pthread_rwlock_timedwrlock
Thomas Wehrspann
thomas at wehrspann.de
Mon Jun 21 00:14:41 UTC 2004
Hi,
I'm using uClibc for some time know for my mini linux system. It's a great
glibc replacement.
I only compiled a few libaries an programs on uClibc, but without problems,
except one: VDR (Video Disk Recorder).
The missing lround function is no problem and the (now included) timegm (or
gmtime?) i could work around.
But the newer versions of VDR introduced 'pthread_rwlock_timedwrlock' and
'pthread_rwlock_timedrdlock'.
Regarding the list of missing SuSv3 function its in the standard.
Are you planning to implement these functions?
Or do you know a workaround?
The problematic code is:
--------------------------------------------------------------------------------------
cRwLock::cRwLock(bool PreferWriter)
{
pthread_rwlockattr_t attr = { PreferWriter ?
PTHREAD_RWLOCK_PREFER_WRITER_NP : PTHREAD_RWLOCK_PREFER_READER_NP };
pthread_rwlock_init(&rwlock, &attr);
}
cRwLock::~cRwLock()
{
pthread_rwlock_destroy(&rwlock);
}
bool cRwLock::Lock(bool Write, int TimeoutMs)
{
int Result = 0;
struct timespec abstime;
if (TimeoutMs) {
abstime.tv_sec = TimeoutMs / 1000;
abstime.tv_nsec = (TimeoutMs % 1000) * 1000000;
}
if (Write)
Result = TimeoutMs ? pthread_rwlock_timedwrlock(&rwlock, &abstime) :
pthread_rwlock_wrlock(&rwlock);
else
Result = TimeoutMs ? pthread_rwlock_timedrdlock(&rwlock, &abstime) :
pthread_rwlock_rdlock(&rwlock);
return Result == 0;
}
void cRwLock::Unlock(void)
{
pthread_rwlock_unlock(&rwlock);
}
--------------------------------------------------------------------------------------
Thanks and best regards,
Thomas
More information about the uClibc
mailing list