2 * Copyright (c) 2015 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 <dali-test-suite-utils.h>
22 #include <dali/devel-api/threading/thread.h>
28 volatile bool gRunThreadEntryFunc = false;
30 class TestThread : public Thread
34 gRunThreadEntryFunc = true;
39 int UtcDaliThreadP(void)
41 tet_infoline("Testing Dali::Thread");
43 gRunThreadEntryFunc = false;
48 // wait till the thread is terminated
49 while( !gRunThreadEntryFunc )
51 usleep( 1 ); // 1 microsecond
53 DALI_TEST_EQUALS( true, gRunThreadEntryFunc, TEST_LOCATION );
57 // Restart the thread after joined
58 gRunThreadEntryFunc = false;
61 // wait till the thread is terminated
62 while( !gRunThreadEntryFunc )
64 usleep( 1 ); // 1 microsecond
66 DALI_TEST_EQUALS( true, gRunThreadEntryFunc, TEST_LOCATION );
71 int UtcDaliThreadNonCopyable(void)
73 // we want to make sure that mutex is not copyable (its copy constructor is not defined)
74 // this test will stop compiling if Mutex has compiler generated copy constructor
75 DALI_COMPILE_TIME_ASSERT( !__has_trivial_copy( Thread ) );
77 DALI_TEST_CHECK( true );