X-Git-Url: http://dolda2000.com/gitweb/?p=utils.git;a=blobdiff_plain;f=loadcpu.c;fp=loadcpu.c;h=ca39f7f62b97bef962305457dff00619fc38d493;hp=0000000000000000000000000000000000000000;hb=a0d86d965081aa3b1410064dcbae947c5d4b42f6;hpb=338cc72b0326d2aa3aeb08b1fa1c11f2a4b6415f diff --git a/loadcpu.c b/loadcpu.c new file mode 100644 index 0000000..ca39f7f --- /dev/null +++ b/loadcpu.c @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include + +static void *spin(void *uu) +{ + while(1) { + } +} + +int main(int argc, char **argv) +{ + int i, n; + + n = 4; + pthread_t threads[n]; + for(i = 0; i < n; i++) { + if(pthread_create(&threads[i], NULL, spin, NULL)) { + fprintf(stderr, "loadcpu: pthread_create: %s\n", strerror(errno)); + exit(1); + } + } + pthread_join(threads[0], NULL); + return(0); +} + +/* + * Local Variables: + * compile-command: "gcc -g -Wall -o loadcpu loadcpu.c -lpthread" + * End: + */