summaryrefslogtreecommitdiffstats
path: root/uisimulator/common
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-09-10 03:49:12 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-09-10 03:49:12 +0000
commitc4a7631eb9235f72de569f5e578620c6e2bc6818 (patch)
tree1e67525787351b2637fab8a4fe0ae140398c9219 /uisimulator/common
parent2e305c6381c72aaabc6d0f92459b32d8939691fb (diff)
downloadrockbox-c4a7631eb9235f72de569f5e578620c6e2bc6818.tar.gz
rockbox-c4a7631eb9235f72de569f5e578620c6e2bc6818.tar.bz2
rockbox-c4a7631eb9235f72de569f5e578620c6e2bc6818.zip
UISIMULATOR: Do a graceful shutdown of all threads and avoid (mostly lockup) problems caused by not worrying about states. Have rockbox objects initialized only by rockbox threads save for the main 'gui' thread which is a needed exception.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14660 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/common')
-rw-r--r--uisimulator/common/io.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index 463bbc68d9..3ad93dc382 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -233,31 +233,29 @@ static int io_thread(void *data)
(void)data;
}
-void sim_io_init(void)
+bool sim_io_init(void)
{
- mutex_init(&io.sim_mutex);
-
io.ready = 0;
io.m = SDL_CreateMutex();
if (io.m == NULL)
{
fprintf(stderr, "Failed to create IO mutex\n");
- exit(-1);
+ return false;
}
io.c = SDL_CreateCond();
if (io.c == NULL)
{
fprintf(stderr, "Failed to create IO cond\n");
- exit(-1);
+ return false;
}
io.t = SDL_CreateThread(io_thread, NULL);
if (io.t == NULL)
{
fprintf(stderr, "Failed to create IO thread\n");
- exit(-1);
+ return false;
}
/* Wait for IO thread to lock mutex */
@@ -268,6 +266,15 @@ void sim_io_init(void)
SDL_LockMutex(io.m);
/* Free it for another thread */
SDL_UnlockMutex(io.m);
+
+ return true;
+}
+
+int ata_init(void)
+{
+ /* Initialize the rockbox kernel objects on a rockbox thread */
+ mutex_init(&io.sim_mutex);
+ return 1;
}
void sim_io_shutdown(void)