diff options
Diffstat (limited to 'rs422lib/sysctl.c')
-rw-r--r-- | rs422lib/sysctl.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/rs422lib/sysctl.c b/rs422lib/sysctl.c index cafcb62..ea05587 100644 --- a/rs422lib/sysctl.c +++ b/rs422lib/sysctl.c @@ -19,8 +19,11 @@ void sysctl_void() } void sysroutine() +// << Drawback: interrupt may happen between else and CPUOFF +// Critical section -> unlikely to have a race condition { - if (syscall>0) + if (!syscall) + _BIS_SR(CPUOFF); switch ((syscall & (-syscall))) // This is used to get the lowest bit { case SYS_BIT7: @@ -56,8 +59,7 @@ void sysroutine() sysarr[0](); break; } - else - _BIS_SR(CPUOFF); + } inline int sys_b2i(int bit) |