summaryrefslogtreecommitdiff
path: root/rpmio/rpmsq.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-03-25 00:22:23 +0000
committerjbj <devnull@localhost>2003-03-25 00:22:23 +0000
commitd79b053df3bd0b0b08d52a3d09a667650b1c7028 (patch)
tree36427414da007b4d70b59ffcbe26222644540de6 /rpmio/rpmsq.c
parent0b8c3f8319fb610f809f3276ae8001b67b85177d (diff)
downloadlibrpm-tizen-d79b053df3bd0b0b08d52a3d09a667650b1c7028.tar.gz
librpm-tizen-d79b053df3bd0b0b08d52a3d09a667650b1c7028.tar.bz2
librpm-tizen-d79b053df3bd0b0b08d52a3d09a667650b1c7028.zip
Repair rdtsc stopwatch, use gettimeofday(3) for now.
CVS patchset: 6716 CVS date: 2003/03/25 00:22:23
Diffstat (limited to 'rpmio/rpmsq.c')
-rw-r--r--rpmio/rpmsq.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/rpmio/rpmsq.c b/rpmio/rpmsq.c
index 94dd4d04f..a27c84b33 100644
--- a/rpmio/rpmsq.c
+++ b/rpmio/rpmsq.c
@@ -319,31 +319,41 @@ static int rpmsqWaitUnregister(rpmsq sq)
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/
{
+ struct rpmsw_s end;
int same_thread = 0;
int ret = 0;
int xx;
- if (same_thread) ret = sighold(SIGCHLD);
+ if (same_thread)
+ ret = sighold(SIGCHLD);
+ else
+ ret = pthread_mutex_lock(&sq->mutex);
+ /* Start the child. */
if (sq->pipes[0] >= 0)
xx = close(sq->pipes[0]);
if (sq->pipes[1] >= 0)
xx = close(sq->pipes[1]);
sq->pipes[0] = sq->pipes[1] = -1;
+ (void) rpmswNow(&sq->begin);
+
/*@-infloops@*/
while (ret == 0 && sq->reaped != sq->child) {
- if (same_thread) {
+ if (same_thread)
ret = sigpause(SIGCHLD);
- } else {
- ret = pthread_mutex_lock(&sq->mutex);
+ else
ret = pthread_cond_wait(&sq->cond, &sq->mutex);
- xx = pthread_mutex_unlock(&sq->mutex);
- }
}
/*@=infloops@*/
- if (same_thread) xx = sigrelse(SIGCHLD);
+ sq->msecs = rpmswDiff(rpmswNow(&end), &sq->begin)/1000;
+ sq->script_msecs += sq->msecs;
+
+ if (same_thread)
+ xx = sigrelse(SIGCHLD);
+ else
+ xx = pthread_mutex_unlock(&sq->mutex);
#ifdef _RPMSQ_DEBUG
/*@-modfilesys@*/