2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Unix version of Switch().
9 #include <exec/execbase.h>
10 #include <proto/exec.h>
17 extern sigset_t sig_int_mask
;
19 AROS_LH0(void, Switch
,
20 struct ExecBase
*, SysBase
, 9, Exec
)
24 struct Task
*this = SysBase
->ThisTask
;
27 If the state is not TS_RUN then the task is already in a list
32 if( this->tc_State
!= TS_RUN
)
35 if( SysBase
->IDNestCnt
>= 0 )
37 sigprocmask(SIG_UNBLOCK
, &sig_int_mask
, NULL
);
40 sigset_t temp_sig_int_mask
;
42 sigemptyset(&temp_sig_int_mask
);
43 sigaddset( &temp_sig_int_mask
, SIGUSR1
);
45 /* Its quite possible that they have interrupts Disabled(),
46 we should fix that here, otherwise we can't switch.
48 We can't call the dispatcher because we need a signal,
51 Have to set the dispatch-required flag.
52 I use SIGUSR1 (maps to SoftInt) because it has less effect on
53 the system clock, and is probably quicker.
56 sigprocmask(SIG_UNBLOCK
, &temp_sig_int_mask
, NULL
);
57 SysBase
->AttnResched
|= 0x8000;
58 kill(getpid(), SIGUSR1
);
59 sigprocmask(SIG_BLOCK
, &temp_sig_int_mask
, NULL
);