Any help in this regard is appreciable and find the error function and
include files below.
Thanks
Include files:
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/poll.h>
#include <limits.h>
Error function:
pthread_t create_worker(void *ctx, void *(*func)(void *))
{
pthread_attr_t attr;
pthread_t childid;
int err;
if (process_mode) {
/* process mode */
/* Fork the receiver. */
switch (fork()) {
case -1: barf("fork()");
case 0:
(*func) (ctx);
exit(0);
}
return (pthread_t) 0;
}
if (pthread_attr_init(&attr) != 0)
barf("pthread_attr_init:");
#ifndef __ia64__
if (pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN) != 0) ---->
Error
barf("pthread_attr_setstacksize");
#endif
if ((err=pthread_create(&childid, &attr, func, ctx)) != 0) {
fprintf(stderr, "pthread_create failed: %s (%d)\n", strerror(err),
err);
exit(-1);
}
return (childid);
}