summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-03-05 17:48:06 +0000
committerThomas Martitz <kugel@rockbox.org>2011-03-05 17:48:06 +0000
commitcc889e9d608e6b07b78541849b7e63b6fb3f6058 (patch)
treeea01a47602b68561d294f705e8ab7669fb00ae9a /apps
parent0b0f99b18ebe6305c9cab12bf8b36d154fc9c87f (diff)
downloadrockbox-cc889e9d608e6b07b78541849b7e63b6fb3f6058.zip
rockbox-cc889e9d608e6b07b78541849b7e63b6fb3f6058.tar.gz
rockbox-cc889e9d608e6b07b78541849b7e63b6fb3f6058.tar.bz2
rockbox-cc889e9d608e6b07b78541849b7e63b6fb3f6058.tar.xz
Change the thread api a bit.
* Remove THREAD_ID_CURRENT macro in favor of a thread_self() function, this allows thread functions to be simpler. * thread_self_entry() shortcut for kernel.c. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29521 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codec_thread.c2
-rw-r--r--apps/plugin.c1
-rw-r--r--apps/plugin.h3
-rw-r--r--apps/plugins/mpegplayer/audio_thread.c4
-rw-r--r--apps/recorder/pcm_record.c6
5 files changed, 9 insertions, 7 deletions
diff --git a/apps/codec_thread.c b/apps/codec_thread.c
index f166f2b..6f15ba1 100644
--- a/apps/codec_thread.c
+++ b/apps/codec_thread.c
@@ -567,7 +567,7 @@ void codec_thread_resume(void)
bool is_codec_thread(void)
{
- return thread_get_current() == codec_thread_id;
+ return thread_self() == codec_thread_id;
}
#ifdef HAVE_PRIORITY_SCHEDULING
diff --git a/apps/plugin.c b/apps/plugin.c
index 192488e..3807ad5 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -779,6 +779,7 @@ static const struct plugin_api rockbox_api = {
/* new stuff at the end, sort into place next time
the API gets incompatible */
+ thread_self,
};
int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 2275b30..43b9818 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -145,7 +145,7 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 200
+#define PLUGIN_API_VERSION 201
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -909,6 +909,7 @@ struct plugin_api {
/* new stuff at the end, sort into place next time
the API gets incompatible */
+ unsigned int (*thread_self)(void);
};
/* plugin header */
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c
index 45fa725..f976fd6 100644
--- a/apps/plugins/mpegplayer/audio_thread.c
+++ b/apps/plugins/mpegplayer/audio_thread.c
@@ -468,7 +468,7 @@ static void audio_thread(void)
struct audio_thread_data td;
#ifdef HAVE_PRIORITY_SCHEDULING
/* Up the priority since the core DSP over-yields internally */
- int old_priority = rb->thread_set_priority(THREAD_ID_CURRENT,
+ int old_priority = rb->thread_set_priority(rb->thread_self(),
PRIORITY_PLAYBACK-4);
#endif
@@ -514,7 +514,7 @@ static void audio_thread(void)
default:
{
#ifdef HAVE_PRIORITY_SCHEDULING
- rb->thread_set_priority(THREAD_ID_CURRENT, old_priority);
+ rb->thread_set_priority(rb->thread_self(), old_priority);
#endif
return;
}
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index 8c9207f..8a832e4 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -897,8 +897,8 @@ static void pcmrec_flush(unsigned flush_num)
priority until finished */
logf("pcmrec: boost (%s)",
num >= flood_watermark ? "num" : "time");
- prio_pcmrec = thread_set_priority(THREAD_ID_CURRENT,
- thread_get_priority(THREAD_ID_CURRENT) - 4);
+ prio_pcmrec = thread_set_priority(thread_self(),
+ thread_get_priority(thread_self()) - 4);
prio_codec = codec_thread_set_priority(
codec_thread_get_priority() - 4);
}
@@ -950,7 +950,7 @@ static void pcmrec_flush(unsigned flush_num)
{
/* return to original priorities */
logf("pcmrec: unboost priority");
- thread_set_priority(THREAD_ID_CURRENT, prio_pcmrec);
+ thread_set_priority(thread_self(), prio_pcmrec);
codec_thread_set_priority(prio_codec);
}