Add barrier struct
Add barrier init function
Add barrier wait function
Add thread function for pthread
Add test