@@ -80,19 +80,19 @@ impl Condvar {
8080 #[ inline]
8181 pub unsafe fn notify_one ( & self ) {
8282 let r = libc:: pthread_cond_signal ( self . inner . get ( ) ) ;
83- debug_assert_eq ! ( r, 0 ) ;
83+ assert_eq ! ( r, 0 , "unexpected error during pthread_cond_signal: {:?}" , r ) ;
8484 }
8585
8686 #[ inline]
8787 pub unsafe fn notify_all ( & self ) {
8888 let r = libc:: pthread_cond_broadcast ( self . inner . get ( ) ) ;
89- debug_assert_eq ! ( r, 0 ) ;
89+ assert_eq ! ( r, 0 , "unexpected error during pthread_cond_broadcast: {:?}" , r ) ;
9090 }
9191
9292 #[ inline]
9393 pub unsafe fn wait ( & self , mutex : & Mutex ) {
9494 let r = libc:: pthread_cond_wait ( self . inner . get ( ) , pthread_mutex:: raw ( mutex) ) ;
95- debug_assert_eq ! ( r, 0 ) ;
95+ assert_eq ! ( r, 0 , "unexpected error during pthread_cond_wait: {:?}" ) ;
9696 }
9797
9898 // This implementation is used on systems that support pthread_condattr_setclock
@@ -168,7 +168,7 @@ impl Condvar {
168168 let mut sys_now = libc:: timeval { tv_sec : 0 , tv_usec : 0 } ;
169169 let stable_now = Instant :: now ( ) ;
170170 let r = libc:: gettimeofday ( & mut sys_now, ptr:: null_mut ( ) ) ;
171- debug_assert_eq ! ( r, 0 ) ;
171+ assert_eq ! ( r, 0 , "unexpected error during gettimeofday: {:?}" , r ) ;
172172
173173 let nsec = dur. subsec_nanos ( ) as libc:: c_long + ( sys_now. tv_usec * 1000 ) as libc:: c_long ;
174174 let extra = ( nsec / 1_000_000_000 ) as libc:: time_t ;
@@ -184,7 +184,11 @@ impl Condvar {
184184
185185 // And wait!
186186 let r = libc:: pthread_cond_timedwait ( self . inner . get ( ) , pthread_mutex:: raw ( mutex) , & timeout) ;
187- debug_assert ! ( r == libc:: ETIMEDOUT || r == 0 ) ;
187+ assert ! (
188+ r == libc:: ETIMEDOUT || r == 0 ,
189+ "unexpected error during pthread_conf_timedwait: {:?}" ,
190+ r
191+ ) ;
188192
189193 // ETIMEDOUT is not a totally reliable method of determining timeout due
190194 // to clock shifts, so do the check ourselves
@@ -195,7 +199,7 @@ impl Condvar {
195199 #[ cfg( not( target_os = "dragonfly" ) ) ]
196200 unsafe fn destroy ( & mut self ) {
197201 let r = libc:: pthread_cond_destroy ( self . inner . get ( ) ) ;
198- debug_assert_eq ! ( r, 0 ) ;
202+ assert_eq ! ( r, 0 , "unexpected error during pthread_cond_destroy: {:?}" , r ) ;
199203 }
200204
201205 #[ inline]
@@ -206,7 +210,11 @@ impl Condvar {
206210 // a condvar that was just initialized with
207211 // libc::PTHREAD_COND_INITIALIZER. Once it is used or
208212 // pthread_cond_init() is called, this behaviour no longer occurs.
209- debug_assert ! ( r == 0 || r == libc:: EINVAL ) ;
213+ assert ! (
214+ r == 0 || r == libc:: EINVAL ,
215+ "unexpected error during pthread_cond_destroy: {:?}" ,
216+ r
217+ ) ;
210218 }
211219}
212220
0 commit comments