diff options
Diffstat (limited to 'uisimulator/common')
-rw-r--r-- | uisimulator/common/io.c | 19 |
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) | |||
233 | (void)data; | 233 | (void)data; |
234 | } | 234 | } |
235 | 235 | ||
236 | void sim_io_init(void) | 236 | bool sim_io_init(void) |
237 | { | 237 | { |
238 | mutex_init(&io.sim_mutex); | ||
239 | |||
240 | io.ready = 0; | 238 | io.ready = 0; |
241 | 239 | ||
242 | io.m = SDL_CreateMutex(); | 240 | io.m = SDL_CreateMutex(); |
243 | if (io.m == NULL) | 241 | if (io.m == NULL) |
244 | { | 242 | { |
245 | fprintf(stderr, "Failed to create IO mutex\n"); | 243 | fprintf(stderr, "Failed to create IO mutex\n"); |
246 | exit(-1); | 244 | return false; |
247 | } | 245 | } |
248 | 246 | ||
249 | io.c = SDL_CreateCond(); | 247 | io.c = SDL_CreateCond(); |
250 | if (io.c == NULL) | 248 | if (io.c == NULL) |
251 | { | 249 | { |
252 | fprintf(stderr, "Failed to create IO cond\n"); | 250 | fprintf(stderr, "Failed to create IO cond\n"); |
253 | exit(-1); | 251 | return false; |
254 | } | 252 | } |
255 | 253 | ||
256 | io.t = SDL_CreateThread(io_thread, NULL); | 254 | io.t = SDL_CreateThread(io_thread, NULL); |
257 | if (io.t == NULL) | 255 | if (io.t == NULL) |
258 | { | 256 | { |
259 | fprintf(stderr, "Failed to create IO thread\n"); | 257 | fprintf(stderr, "Failed to create IO thread\n"); |
260 | exit(-1); | 258 | return false; |
261 | } | 259 | } |
262 | 260 | ||
263 | /* Wait for IO thread to lock mutex */ | 261 | /* Wait for IO thread to lock mutex */ |
@@ -268,6 +266,15 @@ void sim_io_init(void) | |||
268 | SDL_LockMutex(io.m); | 266 | SDL_LockMutex(io.m); |
269 | /* Free it for another thread */ | 267 | /* Free it for another thread */ |
270 | SDL_UnlockMutex(io.m); | 268 | SDL_UnlockMutex(io.m); |
269 | |||
270 | return true; | ||
271 | } | ||
272 | |||
273 | int ata_init(void) | ||
274 | { | ||
275 | /* Initialize the rockbox kernel objects on a rockbox thread */ | ||
276 | mutex_init(&io.sim_mutex); | ||
277 | return 1; | ||
271 | } | 278 | } |
272 | 279 | ||
273 | void sim_io_shutdown(void) | 280 | void sim_io_shutdown(void) |