summaryrefslogtreecommitdiff
path: root/test/regression/interoperability_test/test_frame/tls_test_semaphore_wait.c
blob: fddc4553ce0a0497d2e806d99a0a937330d1f270 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/***************************************************************************/
/* Copyright (c) 2024 Microsoft Corporation                                */
/* Copyright (c) 2026 Eclipse ThreadX contributors                         */
/*                                                                         */
/* This program and the accompanying materials are made available under    */
/* the terms of the MIT License which is available at                      */
/* https://opensource.org/licenses/MIT.                                    */
/*                                                                         */
/* SPDX-License-Identifier: MIT                                            */
/***************************************************************************/

#include "tls_test_frame.h"

/* Wait the system call return success regardless of signals that do not cause test process to terminate. */
INT tls_test_semaphore_wait( TLS_TEST_SEMAPHORE* semaphore_ptr)
{
    INT ret;

    /* Wait for the semaphore ignoring signals. */
    while ( -1 == ( ret = sem_wait( semaphore_ptr)) && ( errno == EINTR));

    /* Check for return value of the system call. */
    return_value_if_fail( -1 != ret, TLS_TEST_SYSTEM_CALL_FAILED);
    return TLS_TEST_SUCCESS;
}