[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Binaries of glibc-2.2 wanted



Florian Lohoff wrote:
> 
> 2.0.38 for mips ? You are on Cobalt Cube - right ?
> 
No - it's on our own hardware (MasqueradeII).

We are getting SIGBUS on 2.2.14.

If anyone can report that this program works on their 2.2.x/2.3.x (mipsel) I
would appriciate it very much!

/* gcc threadtest.c -o threadtest -Wall -lpthread */

#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <errno.h>

#define RUNTIME 10

void * process(void * arg)
{
  int count=0;
  time_t start;
  
  fprintf(stderr, "Starting thread %s\n", (char *)arg);
  usleep(100);
  start=time(NULL);
  while (time(NULL) < start + RUNTIME) {
    write(1, (char *)arg, 1);
    sleep((int)(2.0*rand()/(RAND_MAX+1.0)));
    count++;
  }
  usleep(100);
  printf("\nThread %s ended: count = %d ", (char *)arg, count);
  return NULL;
}

int main()
{
  int retcode;
  pthread_t th_a, th_b;
  void * retval;

  srandom(time(NULL));
  
  retcode = pthread_create(&th_a, NULL, process, "a");
  if (retcode != 0) fprintf(stderr, "create a failed %d: %s\n", retcode,
strerror(errno));

  retcode = pthread_create(&th_b, NULL, process, "b");
  if (retcode != 0) fprintf(stderr, "create b failed %d: %s\n", retcode,
strerror(errno));

  retcode = pthread_join(th_a, &retval);
  if (retcode != 0) fprintf(stderr, "join a failed %d: %s\n", retcode,
strerror(errno));

  retcode = pthread_join(th_b, &retval);
  if (retcode != 0) fprintf(stderr, "join b failed %d: %s\n", retcode,
strerror(errno));

  printf("\n");
  return 0;
}


-- 
Peter L. Hansen
LASAT Networks A/S
pha@lasat.com / peter@hashbang.org



Reply to: