diff --git a/Makefile b/Makefile index aa8cd93..0f144e0 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ check_targets=$(addprefix check_,${all_bins}) src_dirs=$(sort $(dir $(wildcard ${src_dir}/**/))) includes=$(patsubst %,-I%,${src_dirs}) -CFLAGS+=${includes} -march=native -fPIC +CFLAGS+=${includes} -march=native -fPIC -DSMALL_OPTI LDFLAGS+= ifdef USE_PTHREAD LDFLAGS+=-lpthread diff --git a/src/thread/thread.c b/src/thread/thread.c index af1dffc..3b73933 100644 --- a/src/thread/thread.c +++ b/src/thread/thread.c @@ -73,6 +73,11 @@ int thread_yield(void) if (TAILQ_EMPTY(&scheduler_fifo)) return 0; +#ifdef SMALL_OPTI + if (!IS_FINISHED(running) && !IS_WAITING(running) && !IS_MUTEX_WAITING(running)) + return 0; +#endif + if (HAS_STATUS(running, MUTEX_LOCKING)) { if (running->mutex_prio > 0) { running->mutex_prio--;