473,508 Members | 2,040 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pthread_barrier

3 New Member
I'm trying to implement barrier synchronization using pthread_barrier's. Can anyone show me how to implement them. I have

webStress.h
Expand|Select|Wrap|Line Numbers
  1. pthread_barrier_t *startLine;
  2.  
main.c
Expand|Select|Wrap|Line Numbers
  1. #include "webStress.h"
  2. #include <pthread.h>
  3. ....
  4. if((pthread_barrier_init(startLine, NULL, 1)) == 0){ // 1 for testing
  5.    fprintf(stderr, "pthread_barrier_init() failed\n");
  6.    exit(0);
  7. }
  8.  
this code seg faults with the following message
Expand|Select|Wrap|Line Numbers
  1. Program received signal SIGSEGV, Segmentation fault.
  2. [Switching to Thread -1209050944 (LWP 1309)]
  3. 0x002dab32 in pthread_barrier_init () from /lib/i686/nosegneg/libpthread.so.0
  4.  
I'm running this on a linux box (not sure which distro cause it's a school box that I have to ssh into). Compiling with -lpthread which produces no errors and no warnings during compilation.
Any help would be much appreciated.
Apr 7 '07 #1
0 3304

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.