206 |
usermode_p ? timer_bump (&THREAD_CURRENT ()->timer_user, CLOCK_RESOLUTION) |
usermode_p ? timer_bump (&THREAD_CURRENT ()->timer_user, CLOCK_RESOLUTION) |
207 |
: timer_bump (&THREAD_CURRENT ()->timer_system, CLOCK_RESOLUTION); |
: timer_bump (&THREAD_CURRENT ()->timer_system, CLOCK_RESOLUTION); |
208 |
|
|
209 |
/* Increase timestamp counter. */ |
if (CPU_CURRENT () == master_cpu) |
|
|
|
|
ATOMIC_ADD (×tamp_count, 1); |
|
|
|
|
|
/* See if we need to wake up the callout thread. */ |
|
|
|
|
|
spin_lock (&callout_list_lock); |
|
|
|
|
|
if (! queue_empty (&callout_list)) |
|
210 |
{ |
{ |
211 |
struct callout_entry *entry; |
/* Increase timestamp counter. */ |
212 |
|
|
213 |
entry = (struct callout_entry *) queue_first (&callout_list); |
ATOMIC_ADD (×tamp_count, 1); |
214 |
|
|
215 |
if (timestamp_count >= entry->timestamp) |
/* See if we need to wake up the callout thread. */ |
216 |
|
|
217 |
|
spin_lock (&callout_list_lock); |
218 |
|
|
219 |
|
if (! queue_empty (&callout_list)) |
220 |
{ |
{ |
221 |
spin_unlock (&callout_list_lock); |
struct callout_entry *entry; |
222 |
thread_wakeup ((int) &callout_list); |
|
223 |
spin_lock (&callout_list_lock); |
entry = (struct callout_entry *) queue_first (&callout_list); |
224 |
|
|
225 |
|
if (timestamp_count >= entry->timestamp) |
226 |
|
{ |
227 |
|
spin_unlock (&callout_list_lock); |
228 |
|
thread_wakeup ((int) &callout_list); |
229 |
|
spin_lock (&callout_list_lock); |
230 |
|
} |
231 |
} |
} |
|
} |
|
232 |
|
|
233 |
spin_unlock (&callout_list_lock); |
spin_unlock (&callout_list_lock); |
234 |
|
} |
235 |
|
|
236 |
/* Update quantum of current thread and block thread. */ |
/* Update quantum of current thread and block thread. */ |
237 |
|
|