summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-11-20 03:44:25 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-11-20 03:44:25 +0000
commitfadbf0a6f72540b025987a2b3df3f9edd4e3e411 (patch)
tree173f1780a981ad3e37d1df626e31af1b93077b95 /apps
parent31bf5cc8e5bf1e1c06e38829e29bf5da969d5c8e (diff)
downloadrockbox-fadbf0a6f72540b025987a2b3df3f9edd4e3e411.zip
rockbox-fadbf0a6f72540b025987a2b3df3f9edd4e3e411.tar.gz
rockbox-fadbf0a6f72540b025987a2b3df3f9edd4e3e411.tar.bz2
rockbox-fadbf0a6f72540b025987a2b3df3f9edd4e3e411.tar.xz
Make threads responsible for explicit cancellation of their own boosted status. Sleeping and timeouts will no longer cancel it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15709 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/buffering.c2
-rw-r--r--apps/debug_menu.c23
-rw-r--r--apps/playback.c3
-rw-r--r--apps/recorder/radio.c5
-rw-r--r--apps/tree.c1
-rw-r--r--apps/voice_thread.c2
6 files changed, 22 insertions, 14 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index d5ed4e2..18cdb99 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -563,7 +563,6 @@ static bool yield_codec(void)
while (pcmbuf_is_lowdata() && !buffer_is_low())
{
sleep(2);
- trigger_cpu_boost();
if (!queue_empty(&buffering_queue))
return true;
@@ -1267,6 +1266,7 @@ void buffering_thread(void)
while (true)
{
+ cancel_cpu_boost();
queue_wait_w_tmo(&buffering_queue, &ev, filling?5:HZ/2);
switch (ev.id)
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index e3f576d..a8eb786 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -124,16 +124,14 @@ static char thread_status_char(unsigned status)
static char* threads_getname(int selected_item, void * data, char *buffer)
{
(void)data;
+ struct thread_entry *thread;
char name[32];
- struct thread_entry *thread = NULL;
- unsigned status;
- int usage;
#if NUM_CORES > 1
if (selected_item < (int)NUM_CORES)
{
- usage = idle_stack_usage(selected_item);
- snprintf(buffer, MAX_PATH, "Idle (%d): %2d%%", selected_item, usage);
+ snprintf(buffer, MAX_PATH, "Idle (%d): %2d%%", selected_item,
+ idle_stack_usage(selected_item));
return buffer;
}
@@ -141,25 +139,26 @@ static char* threads_getname(int selected_item, void * data, char *buffer)
#endif
thread = &threads[selected_item];
- status = thread_get_status(thread);
-
- if (status == STATE_KILLED)
+
+ if (thread->state == STATE_KILLED)
{
snprintf(buffer, MAX_PATH, "%2d: ---", selected_item);
return buffer;
}
thread_get_name(name, 32, thread);
- usage = thread_stack_usage(thread);
snprintf(buffer, MAX_PATH,
"%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d ") "%2d%% %s",
selected_item,
IF_COP(thread->core,)
- (status == STATE_RUNNING) ? '*' : ' ',
- thread_status_char(status),
+#ifdef HAVE_SCHEDULER_BOOSTCTRL
+ (thread->boosted) ? '+' :
+#endif
+ ((thread->state == STATE_RUNNING) ? '*' : ' '),
+ thread_status_char(thread->state),
IF_PRIO(thread->priority,)
- usage, name);
+ thread_stack_usage(thread), name);
return buffer;
}
diff --git a/apps/playback.c b/apps/playback.c
index 5b9f568..782c613 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -848,6 +848,7 @@ static bool codec_pcmbuf_insert_callback(
while ((dest = pcmbuf_request_buffer(&out_count)) == NULL)
{
+ cancel_cpu_boost();
sleep(1);
if (ci.seek_time || ci.new_track || ci.stop_codec)
return true;
@@ -1277,6 +1278,7 @@ static void codec_thread(void)
while (1) {
status = 0;
+ cancel_cpu_boost();
queue_wait(&codec_queue, &ev);
switch (ev.id) {
@@ -2388,6 +2390,7 @@ static void audio_thread(void)
while (1)
{
+ cancel_cpu_boost();
queue_wait_w_tmo(&audio_queue, &ev, HZ/2);
switch (ev.id) {
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 7a45027..d576755 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -553,6 +553,11 @@ int radio_screen(void)
trigger_cpu_boost();
}
+ if (!update_screen)
+ {
+ cancel_cpu_boost();
+ }
+
#if CONFIG_CODEC != SWCODEC
/* TODO: Can we timeout at HZ when recording since peaks aren't
displayed? This should quiet recordings too. */
diff --git a/apps/tree.c b/apps/tree.c
index 13b0756..5274733 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -1034,6 +1034,7 @@ bool create_playlist(void)
add_dir(filename, sizeof(filename), fd);
close(fd);
+ cancel_cpu_boost();
sleep(HZ);
return true;
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 9e74786..f7494f9 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -249,7 +249,7 @@ static void voice_message(struct voice_thread_data *td)
}
/* Cancel boost */
- sleep(0);
+ cancel_cpu_boost();
td->state = TSTATE_STOPPED;
event_set_state(&voice_event, STATE_SIGNALED);