Guest User

Untitled

a guest
Jan 21st, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.60 KB | None | 0 0
  1. Thread A:
  2.  
  3. Program received signal SIGINT, Interrupt.
  4. [Switching to Thread 0xf7521b70 (LWP 1884)]
  5. 0xf7fdf430 in __kernel_vsyscall ()
  6. (gdb) bt
  7. #0  0xf7fdf430 in __kernel_vsyscall ()
  8. #1  0xf7f00e43 in __lll_lock_wait_private ()
  9.     at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/lowlevellock.S:95
  10. #2  0xf7e960f3 in _L_lock_56 () from /lib32/libc.so.6
  11. #3  0xf7e8fab3 in ptmalloc_lock_all () at arena.c:288
  12. #4  0xf7ebd127 in __libc_fork ()
  13.     at ../nptl/sysdeps/unix/sysv/linux/i386/../fork.c:95
  14. #5  0xf7fb49a4 in __fork () at ../nptl/sysdeps/unix/sysv/linux/pt-fork.c:26
  15. #6  0x08049a60 in main.main() ()
  16. #7  0x0804dd81 in tango.core.Thread.Thread.run() ()
  17. #8  0x0804d2b2 in thread_entryPoint ()
  18. #9  0xf7faa96e in start_thread (arg=0xf7521b70) at pthread_create.c:300
  19. #10 0xf7ef3b5e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
  20.  
  21.  
  22. Thread B:
  23.  
  24. #0  0xf7fdf430 in __kernel_vsyscall ()
  25. #1  0xf7e4ed2e in do_sigsuspend (set=0xf7d21cf8)
  26.     at ../sysdeps/unix/sysv/linux/sigsuspend.c:63
  27. #2  __sigsuspend (set=0xf7d21cf8)
  28.     at ../sysdeps/unix/sysv/linux/sigsuspend.c:78
  29. #3  0x0804d3a6 in thread_suspendHandler ()
  30. #4  <signal handler called>
  31. #5  0xf7e94c5e in __libc_malloc (bytes=10000) at malloc.c:3657
  32. #6  0x08049a88 in main.main() ()
  33. #7  0x0804dd81 in tango.core.Thread.Thread.run() ()
  34. #8  0x0804d2b2 in thread_entryPoint ()
  35. #9  0xf7faa96e in start_thread (arg=0xf7d22b70) at pthread_create.c:300
  36. #10 0xf7ef3b5e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
  37.  
  38.  
  39.  
  40. module main;
  41.  
  42. import tango.core.Exception;
  43. import tango.io.Stdout;
  44. import tango.core.Memory;
  45. import tango.stdc.stdlib;
  46. import tango.util.log.Log;
  47. import tango.sys.Process;
  48. import tango.core.Thread;
  49. import tango.stdc.posix.unistd;
  50. import ocean.util.log.Trace;
  51.  
  52. void main()
  53. {
  54.     void doFork ( )
  55.     {
  56.         while (true)
  57.         {
  58.             Trace.formatln("Suspending");
  59.             thread_suspendAll();
  60.             if ( fork() != 0 )
  61.             {
  62.                 Trace.formatln("Forked");
  63.                 thread_resumeAll();
  64.                 Trace.formatln("Resuming");
  65.             }
  66.             else
  67.             {
  68.                 Trace.formatln("Forked-Child, Exiting");
  69.                 exit(1);
  70.             }
  71.         }
  72.     }
  73.  
  74.     void doMalloc ( )
  75.     {
  76.         while ( true)
  77.         {
  78.             Trace.formatln("Malloc, allocating");
  79.             auto mem = malloc(10000);
  80.             Trace.formatln("Malloc, freeing");
  81.             free(mem);
  82.         }
  83.     }
  84.  
  85.     auto fork   = new Thread(&doFork);
  86.     auto malloc = new Thread(&doMalloc);
  87.  
  88.     malloc.start;
  89.     fork.start;
  90. }
Add Comment
Please, Sign In to add comment