SLOT_LOCK();
- for (slotid = SOUND_SLOT_START; slotid < MANAGER_HANDLE_MAX ; slotid++) {
- if (g_slots[slotid].status == STATUS_IDLE) {
- g_slots[slotid].status = STATUS_SOUND;
- break;
+ while (1) {
+ for (slotid = SOUND_SLOT_START; slotid < MANAGER_HANDLE_MAX ; slotid++) {
+ if (g_slots[slotid].status == STATUS_IDLE) {
+ g_slots[slotid].status = STATUS_SOUND;
+ break;
+ }
}
- }
-
- if (slotid < MANAGER_HANDLE_MAX) {
- debug_msg("New handle allocated (codec slot ID : [%d])\n", slotid);
- *slot = slotid;
- _mm_sound_mgr_codec_shutdown_timer_stop();
-
- } else {
- debug_warning("Handle is full handle : [%d]\n", slotid);
- *slot = -1;
- /* Temporal code for reset */
- while (slotid--) {
- g_slots[slotid].status = STATUS_IDLE;
+ if (slotid < MANAGER_HANDLE_MAX) {
+ debug_msg("New handle allocated (codec slot ID : [%d])", slotid);
+ *slot = slotid;
+ break;
}
- err = MM_ERROR_SOUND_INTERNAL;
+
+ /* FIXME: avoiding infinite wait is required */
+ debug_warning("Handle is full..wait for a while and will retry...");
+ sleep(1);
}
SLOT_UNLOCK();