2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <type_traits>
22 #include <dali-test-suite-utils.h>
23 #include <dali/devel-api/threading/thread.h>
29 volatile bool gRunThreadEntryFunc = false;
31 class TestThread : public Thread
35 gRunThreadEntryFunc = true;
40 int UtcDaliThreadP(void)
42 tet_infoline("Testing Dali::Thread");
44 gRunThreadEntryFunc = false;
49 // wait till the thread is terminated
50 while( !gRunThreadEntryFunc )
52 usleep( 1 ); // 1 microsecond
54 DALI_TEST_EQUALS( true, gRunThreadEntryFunc, TEST_LOCATION );
58 // Restart the thread after joined
59 gRunThreadEntryFunc = false;
62 // wait till the thread is terminated
63 while( !gRunThreadEntryFunc )
65 usleep( 1 ); // 1 microsecond
67 DALI_TEST_EQUALS( true, gRunThreadEntryFunc, TEST_LOCATION );
72 int UtcDaliThreadNonCopyable(void)
74 // we want to make sure that mutex is not copyable (its copy constructor is not defined)
75 // this test will stop compiling if Mutex has compiler generated copy constructor
76 static_assert( !__has_trivial_copy( Thread ), "Thread should NOT be copyable" );
78 DALI_TEST_CHECK( true );