I've tried to use the realtime signals in ast-ksh 20130524 to see if
they are reliable how but ran into instabilities again.
My example I used for testing is this one:
------------cut--------------
compound -a rtar

function rttrap
{
        integer v=${.sh.sig.value}
        integer s=${#rtar[v][@]}

        rtar[v][s]=(
                integer pid=${.sh.sig.pid}
                typeset msg=${v}
                )
}

trap "rttrap" RTMIN
((pid=$$))

for ((p=0 ; p < 10 ; p++ )) ; do
{
        sleep 0.1
        for m in a b c d e f ; do
                kill -q $((16#$m)) -RTMIN $pid
        done
        sleep 0.1
} &
done

while ! wait ; do true ; done



bool fail=false
(( ${#rtar[@]} == 6 )) || { \
        printf "got {#rtar[@]}=${#rtar[@]}, expected 6\n"
        fail=true
        }
for ((i=0xa ; i <= 0xf; i++));do
        (( ${#rtar[$i][*]} == 10 )) || { \
                printf "got {#rtar[$i][*]}=${#rtar[$i][*]},"
                printf "expected 10\n"
                fail=true
                }
done

((fail))&&print -v rtar
------------cut--------------

The example should print nothing if realtime signals are working as
expected. ast-ksh.20130524 however gives me this output:
got {#rtar[10][*]}=1,expected 10
got {#rtar[11][*]}=4,expected 10
got {#rtar[12][*]}=4,expected 10
got {#rtar[13][*]}=4,expected 10
got {#rtar[14][*]}=5,expected 10
got {#rtar[15][*]}=5,expected 10
(
        [10]=(
                (
                        msg=10
                        typeset -l -i pid=55918
                )
        )
        [11]=(
                (
                        typeset -l -i pid=55916
                )
                (
                        typeset -l -i pid=55918
                )
                (
                        msg=11
                        typeset -l -i pid=55922
                )
                (
                        msg=11
                        typeset -l -i pid=55925
                )
        )
        [12]=(
                (
                        msg=12
                        typeset -l -i pid=55918
                )
                (
                        msg=12
                        typeset -l -i pid=55920
                )
                (
                        typeset -l -i pid=55922
                )
                (
                        msg=12
                        typeset -l -i pid=55925
                )
        )
        [13]=(
                (
                        msg=13
                        typeset -l -i pid=55917
                )
                (
                        msg=13
                        typeset -l -i pid=55918
                )
                (
                        msg=13
                        typeset -l -i pid=55924
                )
                (
                        msg=13
                        typeset -l -i pid=55925
                )
        )
        [14]=(
                (
                        typeset -l -i pid=55916
                )
                (
                        msg=14
                        typeset -l -i pid=55917
                )
                (
                        msg=14
                        typeset -l -i pid=55918
                )
                (
                        msg=14
                        typeset -l -i pid=55924
                )
                (
                        msg=14
                        typeset -l -i pid=55925
                )
        )
        [15]=(
                (
                        msg=15
                        typeset -l -i pid=55917
                )
                (
                        msg=15
                        typeset -l -i pid=55920
                )
                (
                        msg=15
                        typeset -l -i pid=55923
                )
                (
                        msg=15
                        typeset -l -i pid=55924
                )
                (
                        msg=15
                        typeset -l -i pid=55925
                )
        )
)

More than half of the signals are lost (which is a violation of the
POSIX realtime spec which mandates that realtime signals must be
reliable) and some of the array entries aren't even filled out (like
rtar[14][0].msg is missing).

Ced
-- 
Cedric Blancher <[email protected]>
Institute Pasteur
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to