forked from len0rd/rockbox
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
This commit is contained in:
parent
2e305c6381
commit
c4a7631eb9
5 changed files with 177 additions and 69 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue