Guest User

Untitled

a guest
Sep 16th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. How to use thread and queue to push and pop data on gSOAP
  2. char* register_user(char *form){
  3. fprintf(stderr,"Entering start register_user---");
  4. int r = 0;
  5. void *p;
  6. char *registeruserresponse;
  7. _Register* rg = malloc(sizeof(_Register));
  8. rg->userid = malloc(sizeof(uint64_t));
  9. rg->firstname = malloc(sizeof(char) * 1024);
  10. rg->lastname = malloc(sizeof(char) * 1024);
  11. rg->username = malloc(sizeof(char) * 1024);
  12. rg->password = malloc(sizeof(char) * 1024);
  13. rg->email = malloc(sizeof(char) * 1024);
  14. rg->userphone = malloc(sizeof(char) * 1024);
  15. rg->time = malloc(sizeof(char) * 1024);
  16. rg = parseregister(form);
  17. register_insert(rg);
  18. p=rg;
  19. pthread_t th_a;
  20. if ( pthread_create( &th_a, NULL, register_insert, p) ) {
  21. printf("error creating thread.");
  22. abort();
  23. };
  24. if ( pthread_join ( th_a, NULL ) ) {
  25. printf("error joining thread.");
  26. abort();
  27. }
  28.  
  29. int u = *((int*)p);
  30. register_insert(rg);
  31. registeruserresponse = loginack(rg->userid);
  32. free(rg);
  33. fprintf(stderr,"leaving start register_user---");
  34. return registeruserresponse;
  35. }
Add Comment
Please, Sign In to add comment