diff options
Diffstat (limited to 'firmware/thread.c')
-rw-r--r-- | firmware/thread.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/firmware/thread.c b/firmware/thread.c index 2ac7f6efc3..e6ab0e4a71 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -161,6 +161,13 @@ void switch_thread(void) | |||
161 | * Processor-specific section | 161 | * Processor-specific section |
162 | */ | 162 | */ |
163 | 163 | ||
164 | #ifdef MAX_PHYS_SECTOR_SIZE | ||
165 | /* Support a special workaround object for large-sector disks */ | ||
166 | #define IF_NO_SKIP_YIELD(...) __VA_ARGS__ | ||
167 | #else | ||
168 | #define IF_NO_SKIP_YIELD(...) | ||
169 | #endif | ||
170 | |||
164 | #if defined(CPU_ARM) | 171 | #if defined(CPU_ARM) |
165 | /*--------------------------------------------------------------------------- | 172 | /*--------------------------------------------------------------------------- |
166 | * Start the thread running and terminate it if it returns | 173 | * Start the thread running and terminate it if it returns |
@@ -1928,8 +1935,9 @@ void switch_thread(void) | |||
1928 | #endif | 1935 | #endif |
1929 | 1936 | ||
1930 | #ifdef HAVE_PRIORITY_SCHEDULING | 1937 | #ifdef HAVE_PRIORITY_SCHEDULING |
1938 | IF_NO_SKIP_YIELD( if (thread->skip_count != -1) ) | ||
1931 | /* Reset the value of thread's skip count */ | 1939 | /* Reset the value of thread's skip count */ |
1932 | thread->skip_count = 0; | 1940 | thread->skip_count = 0; |
1933 | #endif | 1941 | #endif |
1934 | 1942 | ||
1935 | for (;;) | 1943 | for (;;) |
@@ -1985,6 +1993,7 @@ void switch_thread(void) | |||
1985 | * priority threads are runnable. The highest priority runnable | 1993 | * priority threads are runnable. The highest priority runnable |
1986 | * thread(s) are never skipped. */ | 1994 | * thread(s) are never skipped. */ |
1987 | if (priority <= max || | 1995 | if (priority <= max || |
1996 | IF_NO_SKIP_YIELD( thread->skip_count == -1 || ) | ||
1988 | (diff = priority - max, ++thread->skip_count > diff*diff)) | 1997 | (diff = priority - max, ++thread->skip_count > diff*diff)) |
1989 | { | 1998 | { |
1990 | cores[core].running = thread; | 1999 | cores[core].running = thread; |
@@ -2129,7 +2138,8 @@ unsigned int wakeup_thread(struct thread_entry **list) | |||
2129 | if (bl == NULL) | 2138 | if (bl == NULL) |
2130 | { | 2139 | { |
2131 | /* No inheritance - just boost the thread by aging */ | 2140 | /* No inheritance - just boost the thread by aging */ |
2132 | thread->skip_count = thread->priority; | 2141 | IF_NO_SKIP_YIELD( if (thread->skip_count != -1) ) |
2142 | thread->skip_count = thread->priority; | ||
2133 | current = cores[CURRENT_CORE].running; | 2143 | current = cores[CURRENT_CORE].running; |
2134 | } | 2144 | } |
2135 | else | 2145 | else |