summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/alpine_cdc.c8
-rw-r--r--apps/plugins/battery_bench.c18
2 files changed, 9 insertions, 17 deletions
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c
index 6510868..9c1bc8b 100644
--- a/apps/plugins/alpine_cdc.c
+++ b/apps/plugins/alpine_cdc.c
@@ -202,7 +202,6 @@ struct
/* communication to the worker thread */
struct
{
- struct thread_entry *id; /* Pointer of the thread */
bool foreground; /* set as long as we're owning the UI */
bool exiting; /* signal to the thread that we want to exit */
bool ended; /* response from the thread, that is has exited */
@@ -1117,8 +1116,7 @@ void thread(void)
} while (!gTread.exiting);
gTread.ended = true; /* acknowledge the exit */
- rb->remove_thread(gTread.id); /* commit suicide */
- rb->yield(); /* pass control to other threads, we won't return */
+ rb->remove_thread(NULL); /* commit suicide */
}
/* callback to end the TSR plugin, called before a new one gets loaded */
@@ -1172,8 +1170,8 @@ int main(void* parameter)
rb->memset(&gTread, 0, sizeof(gTread));
gTread.foreground = true;
- gTread.id = rb->create_thread(thread, stack, stacksize, "CDC"
- IF_PRIO(, PRIORITY_BACKGROUND));
+ rb->create_thread(thread, stack, stacksize, "CDC"
+ IF_PRIO(, PRIORITY_BACKGROUND));
#ifdef DEBUG
do
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index bf0c2f3..4f1016b 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -111,11 +111,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
return main();
}
-struct
-{
- struct thread_entry *id;
- bool ended;
-} s_thread;
+bool thread_stopped = false;
/* Struct for battery information */
struct batt_info
@@ -142,7 +138,7 @@ bool exit_tsr(bool reenter)
if (exit)
{
rb->queue_post(&thread_q, EV_EXIT, 0);
- while (!s_thread.ended)
+ while (!thread_stopped)
rb->yield();
/* remove the thread's queue from the broadcast list */
rb->queue_delete(&thread_q);
@@ -330,9 +326,8 @@ void thread(void)
#else
"bench exit");
#endif
- s_thread.ended = true;
- rb->remove_thread(s_thread.id);
- rb->yield(); /* exit the thread, this yield() won't return */
+ thread_stopped = true;
+ rb->remove_thread(NULL); /* Suicide. Never returns. */
}
rb->queue_wait_w_tmo(&thread_q, &ev, sleep_time);
@@ -482,10 +477,9 @@ int main(void)
}
rb->queue_init(&thread_q, true); /* put the thread's queue in the bcast list */
- rb->memset(&s_thread, 0, sizeof(s_thread)); /* zero the struct */
- if((s_thread.id = rb->create_thread(thread, thread_stack,
+ if(rb->create_thread(thread, thread_stack,
sizeof(thread_stack), "Battery Benchmark"
- IF_PRIO(, PRIORITY_BACKGROUND))) == NULL)
+ IF_PRIO(, PRIORITY_BACKGROUND)) == NULL)
{
rb->splash(HZ,true,"Cannot create thread!");
return PLUGIN_ERROR;