Commit 4db6bc0f by Benjamin Kosnik Committed by Benjamin Kosnik

mutex (mutex::mutex): Fix usage of initializing macro.

2008-05-06  Benjamin Kosnik  <bkoz@redhat.com>

	* include/std/mutex (mutex::mutex): Fix usage of initializing macro.
	(recursive_mutex::recursive_mutex): Same.
	(once_flag::once_flag): Same.
	* testsuite/30_threads/mutex/cons/assign_neg.cc: Fix line numbers.
	* testsuite/30_threads/mutex/cons/copy_neg.cc: Same.
	* testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Same.
	* testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Same.

From-SVN: r135015
parent 77fa554d
2008-05-06 Benjamin Kosnik <bkoz@redhat.com> 2008-05-06 Benjamin Kosnik <bkoz@redhat.com>
* include/std/mutex (mutex::mutex): Fix usage of initializing macro.
(recursive_mutex::recursive_mutex): Same.
(once_flag::once_flag): Same.
* testsuite/30_threads/mutex/cons/assign_neg.cc: Fix line numbers.
* testsuite/30_threads/mutex/cons/copy_neg.cc: Same.
* testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Same.
* testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Same.
2008-05-06 Benjamin Kosnik <bkoz@redhat.com>
* include/std/condition_variable: New. * include/std/condition_variable: New.
* include/std/mutex: New. * include/std/mutex: New.
* src/condition_variable.cc: New. * src/condition_variable.cc: New.
......
...@@ -63,12 +63,10 @@ namespace std ...@@ -63,12 +63,10 @@ namespace std
native_handle_type __tmp = __GTHREAD_MUTEX_INIT; native_handle_type __tmp = __GTHREAD_MUTEX_INIT;
_M_mutex = __tmp; _M_mutex = __tmp;
#else #else
int __e = __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
#endif
// EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may) // EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
if ( __e)
__throw_system_error(__e);
#endif
} }
void void
...@@ -77,7 +75,7 @@ namespace std ...@@ -77,7 +75,7 @@ namespace std
int __e = __gthread_mutex_lock(&_M_mutex); int __e = __gthread_mutex_lock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may) // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
if ( __e) if (__e)
__throw_system_error(__e); __throw_system_error(__e);
} }
...@@ -87,7 +85,7 @@ namespace std ...@@ -87,7 +85,7 @@ namespace std
int __e = __gthread_mutex_trylock(&_M_mutex); int __e = __gthread_mutex_trylock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY // EINVAL, EAGAIN, EBUSY
if ( __e) if (__e)
__throw_system_error(__e); __throw_system_error(__e);
else else
return true; return true;
...@@ -99,7 +97,7 @@ namespace std ...@@ -99,7 +97,7 @@ namespace std
int __e = __gthread_mutex_unlock(&_M_mutex); int __e = __gthread_mutex_unlock(&_M_mutex);
// EINVAL, EAGAIN, EPERM // EINVAL, EAGAIN, EPERM
if ( __e) if (__e)
__throw_system_error(__e); __throw_system_error(__e);
} }
...@@ -126,12 +124,10 @@ namespace std ...@@ -126,12 +124,10 @@ namespace std
native_handle_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT; native_handle_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
_M_mutex = __tmp; _M_mutex = __tmp;
#else #else
int __e = __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
#endif
// EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may) // EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
if ( __e)
__throw_system_error(__e);
#endif
} }
...@@ -141,7 +137,7 @@ namespace std ...@@ -141,7 +137,7 @@ namespace std
int __e = __gthread_recursive_mutex_lock(&_M_mutex); int __e = __gthread_recursive_mutex_lock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may) // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
if ( __e) if (__e)
__throw_system_error(__e); __throw_system_error(__e);
} }
...@@ -151,7 +147,7 @@ namespace std ...@@ -151,7 +147,7 @@ namespace std
int __e = __gthread_recursive_mutex_trylock(&_M_mutex); int __e = __gthread_recursive_mutex_trylock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY // EINVAL, EAGAIN, EBUSY
if ( __e) if (__e)
__throw_system_error(__e); __throw_system_error(__e);
else else
return true; return true;
...@@ -163,7 +159,7 @@ namespace std ...@@ -163,7 +159,7 @@ namespace std
int __e = __gthread_recursive_mutex_unlock(&_M_mutex); int __e = __gthread_recursive_mutex_unlock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY // EINVAL, EAGAIN, EBUSY
if ( __e) if (__e)
__throw_system_error(__e); __throw_system_error(__e);
} }
...@@ -360,7 +356,11 @@ namespace std ...@@ -360,7 +356,11 @@ namespace std
{ {
typedef __gthread_once_t __native_type; typedef __gthread_once_t __native_type;
once_flag() : _M_once(__GTHREAD_ONCE_INIT) { } once_flag()
{
__native_type __tmp = __GTHREAD_ONCE_INIT;
_M_once = __tmp;
}
__native_type& __native_type&
_M_get() { return _M_once; } _M_get() { return _M_once; }
...@@ -376,7 +376,7 @@ namespace std ...@@ -376,7 +376,7 @@ namespace std
call_once(once_flag& __once, _Callable __f, _Args&&... __args) call_once(once_flag& __once, _Callable __f, _Args&&... __args)
{ {
int __e = __gthread_once(&(__once._M_get()), __f(__args...)); int __e = __gthread_once(&(__once._M_get()), __f(__args...));
if ( __e) if (__e)
__throw_system_error(__e); __throw_system_error(__e);
} }
} }
......
...@@ -39,4 +39,4 @@ void test01() ...@@ -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 *-*-* } 113 } // { dg-error "is private" "" { target *-*-* } 111 }
...@@ -38,4 +38,4 @@ void test01() ...@@ -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 *-*-* } 112 } // { dg-error "is private" "" { target *-*-* } 110 }
...@@ -39,4 +39,4 @@ void test01() ...@@ -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 *-*-* } 177 } // { dg-error "is private" "" { target *-*-* } 173 }
...@@ -38,4 +38,4 @@ void test01() ...@@ -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 *-*-* } 176 } // { dg-error "is private" "" { target *-*-* } 172 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment