ts-7000
[Top] [All Lists]

[ts-7000] Thread Help

To:
Subject: [ts-7000] Thread Help
From: "ashraf_abussaud" <>
Date: Tue, 20 Dec 2005 06:43:36 -0000
Hi All,,,
I am trying to do some threads on the TS-7200 i comiple the follwing
code as a test and i get this error please tell me what is wrong
because i am newbie to linux,,,

Best Regards,,,


Error :
this is the error i got
------------------------------------------------
ts7200:/home/Threads# ts7200:/home/Threads# gcc -o th
mythread.c
/tmp/ccVAjN1M.o: In function `main':
/tmp/ccVAjN1M.o(.text+0x2c): undefined reference to
`pthread_create'
collect2: ld returned 1 exit status
-------------------------------------------------



and this is the Code:
-----------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

int sucess=0;



void *function(void *ptr); //proto type

int main()
{
  pthread_t thread1;
  char *message1 = "Thread 1";
  int  iret;

  pthread_create(&thread1, NULL,(void*)function,(void *)1);


  //pthread_join( thread1, NULL);
 
  sleep(5);// wait 5 second 

  if (sucess==0)
        {
                printf("Fails");
        }
  else
   printf("Sucess");


  printf("Thread 1 returns: %d\n",iret);


  return 0;
}
void *function(void *ptr)
{
  char my_string[500];
  printf("Type something.\n");
  //gets(my_string);
  //printf ("You typed: %s\n", my_string);
  sucess=1;
}





------------------------ Yahoo! Groups Sponsor --------------------~--> 
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/CFFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU