Sponsored Content
Full Discussion: Help with pthread error
Top Forums Programming Help with pthread error Post 302483610 by SuperStout on Monday 27th of December 2010 10:28:35 PM
Old 12-27-2010
Help with pthread error

I have written a C code and when i compile it there are 0 warnings and 0 errors, but when i try to run apears:

Code:
./client: symbol lookup error: ./client: undefined symbol: pthread_create, version GLIBC_2.1

the part of the code where i have the pthread_creat is:

Code:
int serverConection(int socket, int number){
    char buffer[SIZE];
    int recvd;
    pthread_t thread;
    DATA tdata;

    recvd = receivFile(socket, number);
    if(recvd != 0) return -1;
    if(send(socket,&number,sizeof(int),0) <= 0)return -1;
    
    while(recv(socket,buffer,SIZE,0)){
        buffer[strlen(buffer)-1] = '\0';
        
        if(strcmp(buffer,"STARTPLAY")){
                    tdata->wait = 0;
                    tdata->period = 45454;
                    tdata->number = number;
                    //pthread_create(&thread,NULL,clientConnect,(void *)auxSocket);    
                    pthread_create(&thread,NULL,showBanner,&tdata);
        }        
    }
    return 0;
}

i don't understand what's happening i have already used this function many times and this is the first time this happened, i really need some help.
thx
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Pthread compilation error

I have trouble compiling a pthread program on unix system which suppotrs pthreads it gives unresolved _pthread_create _pthread_exit error. what to do? (1 Reply)
Discussion started by: basavaraj_m
1 Replies

2. Programming

More about Pthread

Can someone point to a link where I can get good info about pthread? thanx.. :) (1 Reply)
Discussion started by: jyotipg
1 Replies

3. Programming

pthread

consider if the thread routine returns any void pointer while calling pthread_join, the thread resources are freed and the thread will be terminated when the main thread is exit ,that is my assumption whether it is true how do we find whether the thread is alive or terminated how do we find... (0 Replies)
Discussion started by: MKSRaja
0 Replies

4. Programming

pthread.h

hallo 2 al can anyone pls tell me where and how can i find and install the pthread.h lib ? thx :cool: (2 Replies)
Discussion started by: XinU*
2 Replies

5. UNIX for Dummies Questions & Answers

Where are the pthread functions??

When I use some of the pthread functions: pthread_join, pthread_exit they work perfect. But when I look in the pthread.h file I can't seem to find any implementations of the functions...where are they hiding?? (2 Replies)
Discussion started by: bigblop
2 Replies

6. UNIX for Dummies Questions & Answers

a pthread problem

Hello, I run my pthread code on Linux with 4 processors. However, the speed up is only 2 times. The code is about solving equation (G+s(i)C)z(i)=B*us(i), i=1,...,n. Here G,C are m*m matrix, B*us(i) is a m*1 vector and s(i) are n different numbers. I need to solve the equation n times to... (2 Replies)
Discussion started by: mgig
2 Replies

7. Programming

Error with Pthread

problem solved edited, sorry (1 Reply)
Discussion started by: joey
1 Replies

8. Programming

How can I parallize using pthread

Hi all, How can i parallize this code in pthread? for(round=1;round<=16;round++) { Expansion(mid, 17 - round - 1, left); Expansion(mid, round - 1, right); round++; Expansion(right, 17 - round - 1, mid); Expansion(left, round - 1,mid); } Whereby each loop depend on the... (2 Replies)
Discussion started by: m_enayah
2 Replies

9. UNIX for Advanced & Expert Users

pthread

I am so confused about the user threads and kernel threads.Suppose I created a thread using pthread create call in Linux ,whether it will be a user thread or kernel thread.If it user thread,then how its map to kernel thread. I heard about the M:1,M:N,1:1 mapping methods.Which method linux is... (1 Reply)
Discussion started by: sujith4u87
1 Replies

10. Programming

pthread()

I have a while loop like so: while (counter (file1)); how can I pass that into a pthread_create()? I was thinking ... while(pthread_create(&path, NULL, counter, file)); is that right? (1 Reply)
Discussion started by: l flipboi l
1 Replies
PTHREAD_CREATE(3)					   BSD Library Functions Manual 					 PTHREAD_CREATE(3)

NAME
pthread_create -- create a new thread SYNOPSIS
#include <pthread.h> int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); DESCRIPTION
The pthread_create() function is used to create a new thread, with attributes specified by attr, within a process. If attr is NULL, the default attributes are used. If the attributes specified by attr are modified later, the thread's attributes are not affected. Upon suc- cessful completion pthread_create() will store the ID of the created thread in the location specified by thread. The thread is created executing start_routine with arg as its sole argument. If the start_routine returns, the effect is as if there was an implicit call to pthread_exit() using the return value of start_routine as the exit status. Note that the thread in which main() was origi- nally invoked differs from this. When it returns from main(), the effect is as if there was an implicit call to exit() using the return value of main() as the exit status. Upon thread exit the storage for the thread must be reclaimed by another thread via a call to pthread_join(). Alternatively, pthread_detach() may be called on the thread to indicate that the system may automatically reclaim the thread storage upon exit. The pthread_attr_setdetachstate() function may be used on the attr argument passed to pthread_create() in order to achieve the same effect as a call to pthread_detach() on the newly created thread. The signal state of the new thread is initialized as: o The signal mask is inherited from the creating thread. o The set of signals pending for the new thread is empty. RETURN VALUES
If successful, the pthread_create() function will return zero. Otherwise an error number will be returned to indicate the error. ERRORS
The pthread_create() function will fail if: [EAGAIN] The system lacked the necessary resources to create another thread, or the system-imposed limit on the total number of threads in a process [PTHREAD_THREADS_MAX] would be exceeded. [EPERM] The caller does not have appropriate permission to set the required scheduling parameters or scheduling policy. [EINVAL] The value specified by attr is invalid. SEE ALSO
fork(2), pthread_attr(3), pthread_cancel(3), pthread_cleanup_pop(3), pthread_cleanup_push(3), pthread_exit(3), pthread_join(3) STANDARDS
The pthread_create() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1''). BSD
March 15, 2014 BSD
All times are GMT -4. The time now is 05:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy