1 // Copyright 2020 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 #pragma once 15 16 #include "pw_thread/thread.h" 17 18 namespace pw::thread::test { 19 20 // Two test threads are used to verify the thread facade. 21 const Options& TestOptionsThread0(); 22 const Options& TestOptionsThread1(); 23 24 // Unfortunately the thread facade test's job is also to test detached threads 25 // which may be backed by static contexts or dynamic context heap allocations. 26 // In literally every other case you would use join for this, however that is 27 // not an option here as detached thread functionality is being tested. 28 // For this reason a backend specific cleanup API is provided which shall block 29 // until all the test threads above have finished executions and are ready for 30 // potential re-use and/or freed any dynamic allocations. 31 // 32 // Precondition: The threads must have started to execute before calling this 33 // if cleanup is expected. 34 void WaitUntilDetachedThreadsCleanedUp(); 35 36 } // namespace pw::thread::test 37