mutex (mutex::try_lock): Eat errors.
2008-05-14 Benjamin Kosnik <bkoz@redhat.com> * include/std/mutex (mutex::try_lock): Eat errors. (mutex::unlock): Same. (recursive_mutex::try_lock): Eat errors. (recursive_mutex::unlock): Same. * testsuite/30_threads/mutex/dest/destructor_locked.cc: Add -pthreads, adjust line numbers. * testsuite/30_threads/mutex/native_handle/1.cc: Same. * testsuite/30_threads/mutex/cons/1.cc: Same. * testsuite/30_threads/mutex/try_lock/1.cc: Same. * testsuite/30_threads/mutex/try_lock/2.cc: Same. * testsuite/30_threads/mutex/lock/1.cc: Same. * testsuite/30_threads/mutex/unlock/1.cc: Same. * testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc: Same. * testsuite/30_threads/recursive_mutex/native_handle/1.cc: Same. * testsuite/30_threads/recursive_mutex/cons/1.cc: Same. From-SVN: r135321
This commit is contained in:
parent
2fa9f315d4
commit
22ac021be4
|
@ -1,3 +1,21 @@
|
||||||
|
2008-05-14 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
|
* include/std/mutex (mutex::try_lock): Eat errors.
|
||||||
|
(mutex::unlock): Same.
|
||||||
|
(recursive_mutex::try_lock): Eat errors.
|
||||||
|
(recursive_mutex::unlock): Same.
|
||||||
|
* testsuite/30_threads/mutex/dest/destructor_locked.cc: Add
|
||||||
|
-pthreads, adjust line numbers.
|
||||||
|
* testsuite/30_threads/mutex/native_handle/1.cc: Same.
|
||||||
|
* testsuite/30_threads/mutex/cons/1.cc: Same.
|
||||||
|
* testsuite/30_threads/mutex/try_lock/1.cc: Same.
|
||||||
|
* testsuite/30_threads/mutex/try_lock/2.cc: Same.
|
||||||
|
* testsuite/30_threads/mutex/lock/1.cc: Same.
|
||||||
|
* testsuite/30_threads/mutex/unlock/1.cc: Same.
|
||||||
|
* testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc: Same.
|
||||||
|
* testsuite/30_threads/recursive_mutex/native_handle/1.cc: Same.
|
||||||
|
* testsuite/30_threads/recursive_mutex/cons/1.cc: Same.
|
||||||
|
|
||||||
2008-05-14 Benjamin Kosnik <bkoz@redhat.com>
|
2008-05-14 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* include/std/sstream: Adjust braces.
|
* include/std/sstream: Adjust braces.
|
||||||
|
|
|
@ -59,14 +59,13 @@ namespace std
|
||||||
|
|
||||||
mutex()
|
mutex()
|
||||||
{
|
{
|
||||||
|
// XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
|
||||||
#if defined __GTHREAD_MUTEX_INIT
|
#if defined __GTHREAD_MUTEX_INIT
|
||||||
native_handle_type __tmp = __GTHREAD_MUTEX_INIT;
|
native_handle_type __tmp = __GTHREAD_MUTEX_INIT;
|
||||||
_M_mutex = __tmp;
|
_M_mutex = __tmp;
|
||||||
#else
|
#else
|
||||||
__GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
|
__GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -82,23 +81,15 @@ namespace std
|
||||||
bool
|
bool
|
||||||
try_lock()
|
try_lock()
|
||||||
{
|
{
|
||||||
int __e = __gthread_mutex_trylock(&_M_mutex);
|
// XXX EINVAL, EAGAIN, EBUSY
|
||||||
|
return !__gthread_mutex_trylock(&_M_mutex);
|
||||||
// EINVAL, EAGAIN, EBUSY
|
|
||||||
if (__e)
|
|
||||||
__throw_system_error(__e);
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unlock()
|
unlock()
|
||||||
{
|
{
|
||||||
int __e = __gthread_mutex_unlock(&_M_mutex);
|
// XXX EINVAL, EAGAIN, EPERM
|
||||||
|
__gthread_mutex_unlock(&_M_mutex);
|
||||||
// EINVAL, EAGAIN, EPERM
|
|
||||||
if (__e)
|
|
||||||
__throw_system_error(__e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
native_handle_type
|
native_handle_type
|
||||||
|
@ -120,14 +111,13 @@ namespace std
|
||||||
|
|
||||||
recursive_mutex()
|
recursive_mutex()
|
||||||
{
|
{
|
||||||
|
// XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
|
||||||
#if defined __GTHREAD_RECURSIVE_MUTEX_INIT
|
#if defined __GTHREAD_RECURSIVE_MUTEX_INIT
|
||||||
native_handle_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
|
native_handle_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
|
||||||
_M_mutex = __tmp;
|
_M_mutex = __tmp;
|
||||||
#else
|
#else
|
||||||
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
|
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,23 +134,15 @@ namespace std
|
||||||
bool
|
bool
|
||||||
try_lock()
|
try_lock()
|
||||||
{
|
{
|
||||||
int __e = __gthread_recursive_mutex_trylock(&_M_mutex);
|
// XXX EINVAL, EAGAIN, EBUSY
|
||||||
|
return !__gthread_recursive_mutex_trylock(&_M_mutex);
|
||||||
// EINVAL, EAGAIN, EBUSY
|
|
||||||
if (__e)
|
|
||||||
__throw_system_error(__e);
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unlock()
|
unlock()
|
||||||
{
|
{
|
||||||
int __e = __gthread_recursive_mutex_unlock(&_M_mutex);
|
// XXX EINVAL, EAGAIN, EBUSY
|
||||||
|
__gthread_recursive_mutex_unlock(&_M_mutex);
|
||||||
// EINVAL, EAGAIN, EBUSY
|
|
||||||
if (__e)
|
|
||||||
__throw_system_error(__e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
native_handle_type
|
native_handle_type
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
|
|
@ -39,4 +39,4 @@ void test01()
|
||||||
m1 = m2;
|
m1 = m2;
|
||||||
}
|
}
|
||||||
// { dg-error "within this context" "" { target *-*-* } 39 }
|
// { dg-error "within this context" "" { target *-*-* } 39 }
|
||||||
// { dg-error "is private" "" { target *-*-* } 111 }
|
// { dg-error "is private" "" { target *-*-* } 102 }
|
||||||
|
|
|
@ -38,4 +38,4 @@ void test01()
|
||||||
mutex_type m2(m1);
|
mutex_type m2(m1);
|
||||||
}
|
}
|
||||||
// { dg-error "within this context" "" { target *-*-* } 38 }
|
// { dg-error "within this context" "" { target *-*-* } 38 }
|
||||||
// { dg-error "is private" "" { target *-*-* } 110 }
|
// { dg-error "is private" "" { target *-*-* } 101 }
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
@ -41,11 +42,11 @@ int main()
|
||||||
mutex_type m;
|
mutex_type m;
|
||||||
m.lock();
|
m.lock();
|
||||||
|
|
||||||
// Lock already locked mutex, should be ok.
|
// Lock already locked mutex.
|
||||||
// XXX
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m.lock();
|
// XXX Will block.
|
||||||
|
// m.lock();
|
||||||
}
|
}
|
||||||
catch (const std::system_error& e)
|
catch (const std::system_error& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
@ -45,7 +46,7 @@ int main()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
b = m.try_lock();
|
b = m.try_lock();
|
||||||
VERIFY( b );
|
VERIFY( !b );
|
||||||
}
|
}
|
||||||
catch (const std::system_error& e)
|
catch (const std::system_error& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
|
|
@ -39,4 +39,4 @@ void test01()
|
||||||
m1 = m2;
|
m1 = m2;
|
||||||
}
|
}
|
||||||
// { dg-error "within this context" "" { target *-*-* } 39 }
|
// { dg-error "within this context" "" { target *-*-* } 39 }
|
||||||
// { dg-error "is private" "" { target *-*-* } 173 }
|
// { dg-error "is private" "" { target *-*-* } 155 }
|
||||||
|
|
|
@ -38,4 +38,4 @@ void test01()
|
||||||
mutex_type m2(m1);
|
mutex_type m2(m1);
|
||||||
}
|
}
|
||||||
// { dg-error "within this context" "" { target *-*-* } 38 }
|
// { dg-error "within this context" "" { target *-*-* } 38 }
|
||||||
// { dg-error "is private" "" { target *-*-* } 172 }
|
// { dg-error "is private" "" { target *-*-* } 154 }
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// { dg-options "-std=gnu++0x" }
|
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
|
||||||
|
// { dg-options "-pthread -std=gnu++0x" }
|
||||||
|
|
||||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue