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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
// SPDX-License-Identifier: LGPL-2.1-only
// Copyright © 2018 VMware, Inc. All Rights Reserved.
#include <pthread.h>
#include <stdio.h>
#include "rtpi.h"
int main(int argc, char *argv)
{
pi_mutex_t *mutex;
pi_cond_t *cond;
int ret;
mutex = pi_mutex_alloc();
if (!mutex) {
printf("ERROR: failed to allocated a mutex.\n");
goto out;
}
cond = pi_cond_alloc();
if (!cond) {
printf("ERROR: failed to allocated a cond.\n");
goto out;
}
ret = pi_mutex_init(mutex, 0x0);
if (ret) {
printf("ERROR: pi_mutex_init returned %d\n", ret);
goto out;
}
ret = pi_cond_init(cond, 0x0);
if (ret) {
printf("ERROR: pi_cond_init returned %d\n", ret);
goto out;
}
printf("mutex @ %p\n", mutex);
printf("cond @ %p\n", cond);
out:
return ret;
}
|