1
netbeans에서 학교의 일부 C 프로그램을 프로그래밍하고 싶습니다. 그들은 우리에게 pthread_barrier를 사용해야하는 작업을했습니다. 그래서 netbeans와 cygwin을 gcc, g ++, gdb 및 make와 함께 다운로드했습니다. pthreads.h
에는 pthread_barrier_t
등이 없습니다. this question에는 "장벽은 POSIX 1003.1 edition 2004의 선택적 부분에 정의되어 있습니다"라는 것을 발견했습니다. Qustion은 cygwin에서 netbeans의 장벽을 어떻게 사용할 수 있습니까?netbeans (cygwin)의 pthread_barriers
일부 코드 : 컴파일 또는 Cygwin에서에 사람들을 필요로하는 코드를 실행할 수 없습니다, 그래서
//#define _POSIX_BARRIERS 1
//I don't get it what they mean
//"only if the _POSIX_BARRIERS macro is defined as positive number,
//you can use pthread_barrier_t"
#define _XOPEN_SOURCE 600
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
// declaration of the barrier
pthread_barrier_t a_barrier; // err: Unable to resolve identifier pthread_barrier_t.