Home  |  Buy on line  |  Contact us  |  Terms & Conditions  | 
  



New FOX Board G20



Buy on-line


FOX Board G20
FOX Board LX832
Easy Guardian
SMS FoxBox
Acme Systems srl




FOX Board LX832 is discontinued
To be informed about its availability and prices please CONTACT US
To know more about the new FOX Board G20 GO HERE

Using pthread library

#include <stdio.h>
#include <pthread.h>
#include <unistd.h>

#define NUM_THREADS 5
  
void *thread_function(void *arg) {
  printf("Hello World from %d!\n", (int)arg);
  sleep(1);
  pthread_exit(NULL);
}
  
int main(int argc, char *argv[]) {
  int i;
  pthread_t threads[NUM_THREADS];

  for (i = 0; i < NUM_THREADS; i++)
    pthread_create(&threads[i], NULL, thread_function, (void *)i);
  
  for (i = 0; i < NUM_THREADS; i++)
    pthread_join(threads[i], NULL);

  return 0;
}

AXIS_USABLE_LIBS = UCLIBC GLIBC
include $(AXIS_TOP_DIR)/tools/build/Rules.axis

PROGS = pthread_test
LDFLAGS += -lpthread -D_REENTRANT

all: $(PROGS)
$(PROGS): $(PROGS).o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
	cris-strip $(PROGS)

clean:
	rm -f $(PROGS) *.o core

copytofox:
	scp $(PROGS) 192.168.0.90:/mnt/flash

Links