Understanding 'Sleeping Barber' with 3 barbers in C using pthreads
$begingroup$
I am getting a segmentation fault within my code, but my main misunderstanding lies within whether i am properly using pthreads as well as semaphores. The usual case, or so i have found online, only uses a single barber to handle his customers. In this situation, i have 3 barbers.
Where might i be making my mistake?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
int NUM_BARBERS = 3;
int NUM_CHAIRS = 10;
int NUM_CUSTOMERS = 25;
int CUSTOMER_MAX_INTERVAL = 2;
int HAIRCUT_TIME = 4;
extern int errno;
int chair_availability;
pthread_mutex_t count_lock;
sem_t barber_sem;
sem_t waitingRoom;
sem_t pillow;
sem_t waitCust;
void* get_haircut(void* args){
int temp;
int* arg;
int id;
arg = (int*) args;
id = *arg;
/* Actual logic:
* - Check (and wait) for an available barber
* - Once a chair is occupied, get a haircut
* - Make sure to get out of the chair when we're done!
*
* Remember to be careful and protect your concurrent accesses--but
* don't hold any needless mutexes, or you might risk deadlock!
*
* Bonus: do statistics to see e.g. average wait time, average
* queued customers at any point, etc.
*/
sem_wait(&waitingRoom);
//wait for barber to be free
sem_wait(&barber_sem);
//When Chair is free
sem_post(&waitingRoom);
//Wake barber
sem_post(&pillow);
//Getting a haircut, must wait till finished
sem_wait(&waitCust);
sem_post(&barber_sem);
return 0;
}
int main(int argc, char **argv)
{
int iteration;
int sleep_time;
int result;
int i;
pthread_t threads[NUM_CUSTOMERS];
int Number[NUM_CUSTOMERS];
pthread_t btid;
int allDone;
allDone = 0;
//Initializing Semaphores
sem_init(&waitingRoom, 0, NUM_CHAIRS);
sem_init(&barber_sem,0,1);
sem_init(&pillow, 0, 0);
sem_init(&waitCust,0,0);
if (argc > 1){
NUM_BARBERS = atoi(argv[1]);
if (NUM_BARBERS < 1){
printf("There must be at least one barbern");
return(1);
}
}
if (argc > 2){
NUM_CHAIRS = atoi(argv[2]);
if (NUM_CHAIRS < 1){
printf("There must be at least one chairn");
return(1);
}
}
if (argc > 3){
NUM_CUSTOMERS = atoi(argv[3]);
if (NUM_CUSTOMERS < 1){
printf("There must be at least one customern");
return(1);
}
}
if (argc > 4){
CUSTOMER_MAX_INTERVAL = atoi(argv[4]);
if (CUSTOMER_MAX_INTERVAL < 0){
printf("The customers cannot come in negative timen");
return(1);
}
}
if (argc > 5){
HAIRCUT_TIME = atoi(argv[5]);
if (HAIRCUT_TIME < 1){
printf("Haircuts must take at least one secondn");
return(1);
}
}
printf("Welcome to the barbershop problem!n");
printf("For this run, we have:n");
printf("%i Barbersn", NUM_BARBERS);
printf("%i Chairsn", NUM_CHAIRS);
printf("%i customers will come in with delay from 0 to %i between them.n", NUM_CUSTOMERS, CUSTOMER_MAX_INTERVAL);
printf("A haircut takes %i seconds.nn", HAIRCUT_TIME);
for (i=0; i<NUM_CUSTOMERS; i++) {
Number[i] = i;
}
for (i=0; i<NUM_CUSTOMERS; i++) {
pthread_join(threads[i], NULL);
sleep(1);
}
printf("Beginning Simulation.nn");
srand((unsigned int) time(NULL));
for(iteration=0; iteration<NUM_CUSTOMERS; ++iteration){
pthread_create(&threads, NULL, get_haircut, (void *)&Number[i]);
pthread_detach(threads[iteration]); /* Indicate that the thread shouldn't hold resources */
sleep(4);
}
/* Check (and wait) for any remaining customers */
//the barber is asleep
sem_wait(&pillow);
if(!allDone){
sem_post(&waitCust);
}
else{
printf("The barber is clocking out");
}
//All customers serviced
allDone = 1;
//Wake to go home
sem_post(&pillow);
//Kill barber >:)
pthread_join(btid,NULL);
printf("nBarbershop Problem Completedn");
return(0);
}
c pthreads
New contributor
Zim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
add a comment |
$begingroup$
I am getting a segmentation fault within my code, but my main misunderstanding lies within whether i am properly using pthreads as well as semaphores. The usual case, or so i have found online, only uses a single barber to handle his customers. In this situation, i have 3 barbers.
Where might i be making my mistake?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
int NUM_BARBERS = 3;
int NUM_CHAIRS = 10;
int NUM_CUSTOMERS = 25;
int CUSTOMER_MAX_INTERVAL = 2;
int HAIRCUT_TIME = 4;
extern int errno;
int chair_availability;
pthread_mutex_t count_lock;
sem_t barber_sem;
sem_t waitingRoom;
sem_t pillow;
sem_t waitCust;
void* get_haircut(void* args){
int temp;
int* arg;
int id;
arg = (int*) args;
id = *arg;
/* Actual logic:
* - Check (and wait) for an available barber
* - Once a chair is occupied, get a haircut
* - Make sure to get out of the chair when we're done!
*
* Remember to be careful and protect your concurrent accesses--but
* don't hold any needless mutexes, or you might risk deadlock!
*
* Bonus: do statistics to see e.g. average wait time, average
* queued customers at any point, etc.
*/
sem_wait(&waitingRoom);
//wait for barber to be free
sem_wait(&barber_sem);
//When Chair is free
sem_post(&waitingRoom);
//Wake barber
sem_post(&pillow);
//Getting a haircut, must wait till finished
sem_wait(&waitCust);
sem_post(&barber_sem);
return 0;
}
int main(int argc, char **argv)
{
int iteration;
int sleep_time;
int result;
int i;
pthread_t threads[NUM_CUSTOMERS];
int Number[NUM_CUSTOMERS];
pthread_t btid;
int allDone;
allDone = 0;
//Initializing Semaphores
sem_init(&waitingRoom, 0, NUM_CHAIRS);
sem_init(&barber_sem,0,1);
sem_init(&pillow, 0, 0);
sem_init(&waitCust,0,0);
if (argc > 1){
NUM_BARBERS = atoi(argv[1]);
if (NUM_BARBERS < 1){
printf("There must be at least one barbern");
return(1);
}
}
if (argc > 2){
NUM_CHAIRS = atoi(argv[2]);
if (NUM_CHAIRS < 1){
printf("There must be at least one chairn");
return(1);
}
}
if (argc > 3){
NUM_CUSTOMERS = atoi(argv[3]);
if (NUM_CUSTOMERS < 1){
printf("There must be at least one customern");
return(1);
}
}
if (argc > 4){
CUSTOMER_MAX_INTERVAL = atoi(argv[4]);
if (CUSTOMER_MAX_INTERVAL < 0){
printf("The customers cannot come in negative timen");
return(1);
}
}
if (argc > 5){
HAIRCUT_TIME = atoi(argv[5]);
if (HAIRCUT_TIME < 1){
printf("Haircuts must take at least one secondn");
return(1);
}
}
printf("Welcome to the barbershop problem!n");
printf("For this run, we have:n");
printf("%i Barbersn", NUM_BARBERS);
printf("%i Chairsn", NUM_CHAIRS);
printf("%i customers will come in with delay from 0 to %i between them.n", NUM_CUSTOMERS, CUSTOMER_MAX_INTERVAL);
printf("A haircut takes %i seconds.nn", HAIRCUT_TIME);
for (i=0; i<NUM_CUSTOMERS; i++) {
Number[i] = i;
}
for (i=0; i<NUM_CUSTOMERS; i++) {
pthread_join(threads[i], NULL);
sleep(1);
}
printf("Beginning Simulation.nn");
srand((unsigned int) time(NULL));
for(iteration=0; iteration<NUM_CUSTOMERS; ++iteration){
pthread_create(&threads, NULL, get_haircut, (void *)&Number[i]);
pthread_detach(threads[iteration]); /* Indicate that the thread shouldn't hold resources */
sleep(4);
}
/* Check (and wait) for any remaining customers */
//the barber is asleep
sem_wait(&pillow);
if(!allDone){
sem_post(&waitCust);
}
else{
printf("The barber is clocking out");
}
//All customers serviced
allDone = 1;
//Wake to go home
sem_post(&pillow);
//Kill barber >:)
pthread_join(btid,NULL);
printf("nBarbershop Problem Completedn");
return(0);
}
c pthreads
New contributor
Zim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
$begingroup$
I'm sorry we don't help debug code here. We review working code.
$endgroup$
– bruglesco
9 mins ago
$begingroup$
Its not the seg fault i am hoping to get fixed, it's the pthread and semaphore usage i am hoping to get cleared up.
$endgroup$
– Zim
8 mins ago
$begingroup$
Fix the segfault first. Its not review ready code til its working.
$endgroup$
– bruglesco
6 mins ago
add a comment |
$begingroup$
I am getting a segmentation fault within my code, but my main misunderstanding lies within whether i am properly using pthreads as well as semaphores. The usual case, or so i have found online, only uses a single barber to handle his customers. In this situation, i have 3 barbers.
Where might i be making my mistake?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
int NUM_BARBERS = 3;
int NUM_CHAIRS = 10;
int NUM_CUSTOMERS = 25;
int CUSTOMER_MAX_INTERVAL = 2;
int HAIRCUT_TIME = 4;
extern int errno;
int chair_availability;
pthread_mutex_t count_lock;
sem_t barber_sem;
sem_t waitingRoom;
sem_t pillow;
sem_t waitCust;
void* get_haircut(void* args){
int temp;
int* arg;
int id;
arg = (int*) args;
id = *arg;
/* Actual logic:
* - Check (and wait) for an available barber
* - Once a chair is occupied, get a haircut
* - Make sure to get out of the chair when we're done!
*
* Remember to be careful and protect your concurrent accesses--but
* don't hold any needless mutexes, or you might risk deadlock!
*
* Bonus: do statistics to see e.g. average wait time, average
* queued customers at any point, etc.
*/
sem_wait(&waitingRoom);
//wait for barber to be free
sem_wait(&barber_sem);
//When Chair is free
sem_post(&waitingRoom);
//Wake barber
sem_post(&pillow);
//Getting a haircut, must wait till finished
sem_wait(&waitCust);
sem_post(&barber_sem);
return 0;
}
int main(int argc, char **argv)
{
int iteration;
int sleep_time;
int result;
int i;
pthread_t threads[NUM_CUSTOMERS];
int Number[NUM_CUSTOMERS];
pthread_t btid;
int allDone;
allDone = 0;
//Initializing Semaphores
sem_init(&waitingRoom, 0, NUM_CHAIRS);
sem_init(&barber_sem,0,1);
sem_init(&pillow, 0, 0);
sem_init(&waitCust,0,0);
if (argc > 1){
NUM_BARBERS = atoi(argv[1]);
if (NUM_BARBERS < 1){
printf("There must be at least one barbern");
return(1);
}
}
if (argc > 2){
NUM_CHAIRS = atoi(argv[2]);
if (NUM_CHAIRS < 1){
printf("There must be at least one chairn");
return(1);
}
}
if (argc > 3){
NUM_CUSTOMERS = atoi(argv[3]);
if (NUM_CUSTOMERS < 1){
printf("There must be at least one customern");
return(1);
}
}
if (argc > 4){
CUSTOMER_MAX_INTERVAL = atoi(argv[4]);
if (CUSTOMER_MAX_INTERVAL < 0){
printf("The customers cannot come in negative timen");
return(1);
}
}
if (argc > 5){
HAIRCUT_TIME = atoi(argv[5]);
if (HAIRCUT_TIME < 1){
printf("Haircuts must take at least one secondn");
return(1);
}
}
printf("Welcome to the barbershop problem!n");
printf("For this run, we have:n");
printf("%i Barbersn", NUM_BARBERS);
printf("%i Chairsn", NUM_CHAIRS);
printf("%i customers will come in with delay from 0 to %i between them.n", NUM_CUSTOMERS, CUSTOMER_MAX_INTERVAL);
printf("A haircut takes %i seconds.nn", HAIRCUT_TIME);
for (i=0; i<NUM_CUSTOMERS; i++) {
Number[i] = i;
}
for (i=0; i<NUM_CUSTOMERS; i++) {
pthread_join(threads[i], NULL);
sleep(1);
}
printf("Beginning Simulation.nn");
srand((unsigned int) time(NULL));
for(iteration=0; iteration<NUM_CUSTOMERS; ++iteration){
pthread_create(&threads, NULL, get_haircut, (void *)&Number[i]);
pthread_detach(threads[iteration]); /* Indicate that the thread shouldn't hold resources */
sleep(4);
}
/* Check (and wait) for any remaining customers */
//the barber is asleep
sem_wait(&pillow);
if(!allDone){
sem_post(&waitCust);
}
else{
printf("The barber is clocking out");
}
//All customers serviced
allDone = 1;
//Wake to go home
sem_post(&pillow);
//Kill barber >:)
pthread_join(btid,NULL);
printf("nBarbershop Problem Completedn");
return(0);
}
c pthreads
New contributor
Zim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
I am getting a segmentation fault within my code, but my main misunderstanding lies within whether i am properly using pthreads as well as semaphores. The usual case, or so i have found online, only uses a single barber to handle his customers. In this situation, i have 3 barbers.
Where might i be making my mistake?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
int NUM_BARBERS = 3;
int NUM_CHAIRS = 10;
int NUM_CUSTOMERS = 25;
int CUSTOMER_MAX_INTERVAL = 2;
int HAIRCUT_TIME = 4;
extern int errno;
int chair_availability;
pthread_mutex_t count_lock;
sem_t barber_sem;
sem_t waitingRoom;
sem_t pillow;
sem_t waitCust;
void* get_haircut(void* args){
int temp;
int* arg;
int id;
arg = (int*) args;
id = *arg;
/* Actual logic:
* - Check (and wait) for an available barber
* - Once a chair is occupied, get a haircut
* - Make sure to get out of the chair when we're done!
*
* Remember to be careful and protect your concurrent accesses--but
* don't hold any needless mutexes, or you might risk deadlock!
*
* Bonus: do statistics to see e.g. average wait time, average
* queued customers at any point, etc.
*/
sem_wait(&waitingRoom);
//wait for barber to be free
sem_wait(&barber_sem);
//When Chair is free
sem_post(&waitingRoom);
//Wake barber
sem_post(&pillow);
//Getting a haircut, must wait till finished
sem_wait(&waitCust);
sem_post(&barber_sem);
return 0;
}
int main(int argc, char **argv)
{
int iteration;
int sleep_time;
int result;
int i;
pthread_t threads[NUM_CUSTOMERS];
int Number[NUM_CUSTOMERS];
pthread_t btid;
int allDone;
allDone = 0;
//Initializing Semaphores
sem_init(&waitingRoom, 0, NUM_CHAIRS);
sem_init(&barber_sem,0,1);
sem_init(&pillow, 0, 0);
sem_init(&waitCust,0,0);
if (argc > 1){
NUM_BARBERS = atoi(argv[1]);
if (NUM_BARBERS < 1){
printf("There must be at least one barbern");
return(1);
}
}
if (argc > 2){
NUM_CHAIRS = atoi(argv[2]);
if (NUM_CHAIRS < 1){
printf("There must be at least one chairn");
return(1);
}
}
if (argc > 3){
NUM_CUSTOMERS = atoi(argv[3]);
if (NUM_CUSTOMERS < 1){
printf("There must be at least one customern");
return(1);
}
}
if (argc > 4){
CUSTOMER_MAX_INTERVAL = atoi(argv[4]);
if (CUSTOMER_MAX_INTERVAL < 0){
printf("The customers cannot come in negative timen");
return(1);
}
}
if (argc > 5){
HAIRCUT_TIME = atoi(argv[5]);
if (HAIRCUT_TIME < 1){
printf("Haircuts must take at least one secondn");
return(1);
}
}
printf("Welcome to the barbershop problem!n");
printf("For this run, we have:n");
printf("%i Barbersn", NUM_BARBERS);
printf("%i Chairsn", NUM_CHAIRS);
printf("%i customers will come in with delay from 0 to %i between them.n", NUM_CUSTOMERS, CUSTOMER_MAX_INTERVAL);
printf("A haircut takes %i seconds.nn", HAIRCUT_TIME);
for (i=0; i<NUM_CUSTOMERS; i++) {
Number[i] = i;
}
for (i=0; i<NUM_CUSTOMERS; i++) {
pthread_join(threads[i], NULL);
sleep(1);
}
printf("Beginning Simulation.nn");
srand((unsigned int) time(NULL));
for(iteration=0; iteration<NUM_CUSTOMERS; ++iteration){
pthread_create(&threads, NULL, get_haircut, (void *)&Number[i]);
pthread_detach(threads[iteration]); /* Indicate that the thread shouldn't hold resources */
sleep(4);
}
/* Check (and wait) for any remaining customers */
//the barber is asleep
sem_wait(&pillow);
if(!allDone){
sem_post(&waitCust);
}
else{
printf("The barber is clocking out");
}
//All customers serviced
allDone = 1;
//Wake to go home
sem_post(&pillow);
//Kill barber >:)
pthread_join(btid,NULL);
printf("nBarbershop Problem Completedn");
return(0);
}
c pthreads
c pthreads
New contributor
Zim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Zim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Zim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 11 mins ago
ZimZim
1
1
New contributor
Zim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Zim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Zim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$begingroup$
I'm sorry we don't help debug code here. We review working code.
$endgroup$
– bruglesco
9 mins ago
$begingroup$
Its not the seg fault i am hoping to get fixed, it's the pthread and semaphore usage i am hoping to get cleared up.
$endgroup$
– Zim
8 mins ago
$begingroup$
Fix the segfault first. Its not review ready code til its working.
$endgroup$
– bruglesco
6 mins ago
add a comment |
$begingroup$
I'm sorry we don't help debug code here. We review working code.
$endgroup$
– bruglesco
9 mins ago
$begingroup$
Its not the seg fault i am hoping to get fixed, it's the pthread and semaphore usage i am hoping to get cleared up.
$endgroup$
– Zim
8 mins ago
$begingroup$
Fix the segfault first. Its not review ready code til its working.
$endgroup$
– bruglesco
6 mins ago
$begingroup$
I'm sorry we don't help debug code here. We review working code.
$endgroup$
– bruglesco
9 mins ago
$begingroup$
I'm sorry we don't help debug code here. We review working code.
$endgroup$
– bruglesco
9 mins ago
$begingroup$
Its not the seg fault i am hoping to get fixed, it's the pthread and semaphore usage i am hoping to get cleared up.
$endgroup$
– Zim
8 mins ago
$begingroup$
Its not the seg fault i am hoping to get fixed, it's the pthread and semaphore usage i am hoping to get cleared up.
$endgroup$
– Zim
8 mins ago
$begingroup$
Fix the segfault first. Its not review ready code til its working.
$endgroup$
– bruglesco
6 mins ago
$begingroup$
Fix the segfault first. Its not review ready code til its working.
$endgroup$
– bruglesco
6 mins ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Zim is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214143%2funderstanding-sleeping-barber-with-3-barbers-in-c-using-pthreads%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Zim is a new contributor. Be nice, and check out our Code of Conduct.
Zim is a new contributor. Be nice, and check out our Code of Conduct.
Zim is a new contributor. Be nice, and check out our Code of Conduct.
Zim is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214143%2funderstanding-sleeping-barber-with-3-barbers-in-c-using-pthreads%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
I'm sorry we don't help debug code here. We review working code.
$endgroup$
– bruglesco
9 mins ago
$begingroup$
Its not the seg fault i am hoping to get fixed, it's the pthread and semaphore usage i am hoping to get cleared up.
$endgroup$
– Zim
8 mins ago
$begingroup$
Fix the segfault first. Its not review ready code til its working.
$endgroup$
– bruglesco
6 mins ago