Adds an entry to the queue. nlohmann::json obj: The object. C2D_Image icn: The icon. */
| 48 | C2D_Image icn: The icon. |
| 49 | */ |
| 50 | void QueueSystem::AddToQueue(nlohmann::json obj, const C2D_Image &icn, const std::string &name, const std::string &uName, const std::string &eName, const std::string &lUpdated) { |
| 51 | queueEntries.push_back( std::make_unique<Queue>(obj, icn, name, uName, eName, lUpdated) ); |
| 52 | |
| 53 | /* If not already running, let it run!! */ |
| 54 | if (!QueueRuns && !QueueSystem::Wait) { |
| 55 | QueueRuns = true; // We enable the queue run state here. |
| 56 | |
| 57 | if (queueThread) { |
| 58 | threadJoin(queueThread, U64_MAX); |
| 59 | threadFree(queueThread); |
| 60 | queueThread = nullptr; |
| 61 | } |
| 62 | |
| 63 | s32 prio = 0; |
| 64 | |
| 65 | svcGetThreadPriority(&prio, CUR_THREAD_HANDLE); |
| 66 | queueThread = threadCreate((ThreadFunc)QueueSystem::QueueHandle, NULL, 64 * 1024, prio - 1, -2, false); |
| 67 | ExclusiveMode::Enter(); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | /* |
| 72 | Clears the queue. |