| 937 | #if defined(TASKING_INTERNAL) |
| 938 | |
| 939 | void Scene::commit_internal (bool join) |
| 940 | { |
| 941 | Lock<MutexSys> buildLock(buildMutex,false); |
| 942 | |
| 943 | /* allocates own taskscheduler for each build */ |
| 944 | Ref<TaskScheduler> scheduler = nullptr; |
| 945 | { |
| 946 | Lock<MutexSys> lock(taskGroup->schedulerMutex); |
| 947 | scheduler = taskGroup->scheduler; |
| 948 | if (scheduler == null) { |
| 949 | buildLock.lock(); |
| 950 | taskGroup->scheduler = scheduler = new TaskScheduler; |
| 951 | } |
| 952 | } |
| 953 | |
| 954 | /* worker threads join build */ |
| 955 | if (!buildLock.isLocked()) |
| 956 | { |
| 957 | if (!join) |
| 958 | throw_RTCError(RTC_ERROR_INVALID_OPERATION,"use rtcJoinCommitScene to join a build operation"); |
| 959 | |
| 960 | scheduler->join(); |
| 961 | return; |
| 962 | } |
| 963 | |
| 964 | /* initiate build */ |
| 965 | try { |
| 966 | TaskScheduler::TaskGroupContext context; |
| 967 | scheduler->spawn_root([&]() { commit_task(); Lock<MutexSys> lock(taskGroup->schedulerMutex); taskGroup->scheduler = nullptr; }, &context, 1, !join); |
| 968 | } |
| 969 | catch (...) { |
| 970 | accels_clear(); |
| 971 | Lock<MutexSys> lock(taskGroup->schedulerMutex); |
| 972 | taskGroup->scheduler = nullptr; |
| 973 | throw; |
| 974 | } |
| 975 | } |
| 976 | |
| 977 | #endif |
| 978 |
nothing calls this directly
no test coverage detected