Browse Source

race conditions elimintad:
fixed to open reply fifo before fifo request is sent out

Jiri Kuthan 23 years ago
parent
commit
1485fbbb8d
1 changed files with 16 additions and 8 deletions
  1. 16 8
      scripts/sc

+ 16 - 8
scripts/sc

@@ -136,8 +136,13 @@ fifo_cmd()
 		exit 1
 		exit 1
 	fi
 	fi
 
 
+	# start reader now so that it is ready for replies
+	# immediately after a request was sent out
+	cat < $path &
+
+	# issue request
 	if [ "$#" -eq 1 ] ; then
 	if [ "$#" -eq 1 ] ; then
-		cat > $SER_FIFO <<EOF
+		cat > $SER_FIFO <<EOF 
 :$1:$name
 :$1:$name
 
 
 EOF
 EOF
@@ -155,9 +160,8 @@ $3
 
 
 EOF
 EOF
 	fi
 	fi
-
-
-	cat < $path
+	# wait for the reader to complete
+	wait
 	rm $path
 	rm $path
 }
 }
 
 
@@ -167,37 +171,41 @@ print_stats() {
 
 
 echo "[cycle #: $3; if constant make sure server lives and fifo is on]"
 echo "[cycle #: $3; if constant make sure server lives and fifo is on]"
 
 
+cat < $2 &
 cat > $SER_FIFO <<EOF
 cat > $SER_FIFO <<EOF
 :version:$1
 :version:$1
 
 
 :uptime:$1
 :uptime:$1
 
 
 EOF
 EOF
-cat < $2
+wait
 echo
 echo
 
 
 echo Transaction Statistics
 echo Transaction Statistics
+cat < $2 &
 cat > $SER_FIFO <<EOF
 cat > $SER_FIFO <<EOF
 :t_stats:$1
 :t_stats:$1
 
 
 EOF
 EOF
-cat < $2
+wait
 echo
 echo
 
 
 echo Stateless Server Statistics
 echo Stateless Server Statistics
+cat < $2 &
 cat > $SER_FIFO <<EOF
 cat > $SER_FIFO <<EOF
 :sl_stats:$1
 :sl_stats:$1
 
 
 EOF
 EOF
-cat < $2
+wait
 echo
 echo
 
 
 echo UsrLoc Stats
 echo UsrLoc Stats
+cat < $2 &
 cat > $SER_FIFO <<EOF
 cat > $SER_FIFO <<EOF
 :ul_stats:$1
 :ul_stats:$1
 
 
 EOF
 EOF
-cat < $2
+wait
 }
 }