Research portable Memory game | Исследовать портируемую игру Память
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
748B

  1. #include "uthash.h"
  2. #include <stdlib.h> /* malloc */
  3. #include <stdio.h> /* printf */
  4. #include <unistd.h> /* getpid */
  5. typedef struct example_user_t {
  6. int id;
  7. int cookie;
  8. UT_hash_handle hh;
  9. } example_user_t;
  10. int main()
  11. {
  12. int i;
  13. example_user_t *user, *users=NULL;
  14. /* create elements */
  15. for(i=0; i<10000; i++) {
  16. if ( (user = (example_user_t*)malloc(sizeof(example_user_t))) == NULL) {
  17. exit(-1);
  18. }
  19. user->id = i;
  20. user->cookie = i*i;
  21. HASH_ADD_INT(users,id,user);
  22. }
  23. printf("pid: %u\n", (unsigned)getpid());
  24. /* printf("sig: %p\n", &users->hh.tbl->signature); */
  25. /* printf("bbv: %p\n", &users->hh.tbl->bloom_bv); */
  26. sleep(60*10);
  27. return 0;
  28. }