33#ifdef STACKLESS
44#include "core/stackless_impl.h"
55
6- #ifdef WITH_THREAD
76#include "pythread.h"
8- #endif
97
108/******************************************************
119
@@ -673,12 +671,9 @@ slp_ensure_linkage(PyTaskletObject *t)
673671static int
674672is_thread_runnable (PyThreadState * ts )
675673{
676- #ifdef WITH_THREAD
677674 if (ts == PyThreadState_GET ())
678675 return 0 ;
679676 return !ts -> st .thread .is_blocked ;
680- #endif
681- return 0 ;
682677}
683678
684679static int
@@ -707,8 +702,6 @@ make_deadlock_bomb(void)
707702 return slp_curexc_to_bomb ();
708703}
709704
710- #ifdef WITH_THREAD
711-
712705/* make sure that locks live longer than their threads */
713706
714707static void
@@ -774,13 +767,6 @@ void slp_thread_unblock(PyThreadState *nts)
774767 schedule_thread_unblock (nts );
775768}
776769
777- #else
778-
779- void slp_thread_unblock (PyThreadState * nts )
780- {}
781-
782- #endif
783-
784770static int
785771schedule_task_block (PyObject * * result , PyTaskletObject * prev , int stackless , int * did_switch )
786772{
@@ -793,19 +779,16 @@ schedule_task_block(PyObject **result, PyTaskletObject *prev, int stackless, int
793779 /* which "main" do we awaken if we are blocking? */
794780 wakeup = slp_get_watchdog (ts , 0 );
795781
796- #ifdef WITH_THREAD
797782 if ( !(ts -> st .runflags & Py_WATCHDOG_THREADBLOCK ) && wakeup -> next == NULL )
798783 /* we also must never block if watchdog is running not in threadblocking mode */
799784 revive_main = 1 ;
800785
801786 if (revive_main )
802787 assert (wakeup -> next == NULL ); /* target must be floating */
803- #endif
804788
805789 if (revive_main || check_for_deadlock ()) {
806790 goto cantblock ;
807791 }
808- #ifdef WITH_THREAD
809792 for (;;) {
810793 /* store the frame back in the tasklet while we thread block, so that
811794 * e.g. insert doesn't think that it is dead
@@ -832,10 +815,6 @@ schedule_task_block(PyObject **result, PyTaskletObject *prev, int stackless, int
832815 if (check_for_deadlock ())
833816 goto cantblock ;
834817 }
835- #else
836- next = prev ;
837- Py_INCREF (next );
838- #endif
839818 /* this must be after releasing the locks because of hard switching */
840819 fail = slp_schedule_task (result , prev , next , stackless , did_switch );
841820 Py_DECREF (next );
@@ -881,7 +860,6 @@ schedule_task_block(PyObject **result, PyTaskletObject *prev, int stackless, int
881860 return fail ;
882861}
883862
884- #ifdef WITH_THREAD
885863static int
886864schedule_task_interthread (PyObject * * result ,
887865 PyTaskletObject * prev ,
@@ -921,8 +899,6 @@ schedule_task_interthread(PyObject **result,
921899 return 0 ;
922900}
923901
924- #endif
925-
926902/* deal with soft interrupts by modifying next to specify the main tasklet */
927903static void slp_schedule_soft_irq (PyThreadState * ts , PyTaskletObject * prev ,
928904 PyTaskletObject * * next , int not_now )
@@ -993,15 +969,13 @@ slp_schedule_task(PyObject **result, PyTaskletObject *prev, PyTaskletObject *nex
993969 if (next == NULL )
994970 return schedule_task_block (result , prev , stackless , did_switch );
995971
996- #ifdef WITH_THREAD
997972 /* note that next->cstate is undefined if it is ourself.
998973 Also note, that prev->cstate->tstate == NULL during Py_Finalize() */
999974 assert (prev -> cstate == NULL || prev -> cstate -> tstate == NULL || prev -> cstate -> tstate == ts );
1000975 /* The last condition is required during shutdown when next->cstate->tstate == NULL */
1001976 if (next -> cstate != NULL && next -> cstate -> tstate != ts && next != prev ) {
1002977 return schedule_task_interthread (result , prev , next , stackless , did_switch );
1003978 }
1004- #endif
1005979
1006980 /* switch trap. We don't trap on interthread switches because they
1007981 * don't cause a switch on the local thread.
0 commit comments