fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. #i n c l u d e <stdlib .h>
  8. #i n c l u d e <stdio .h>
  9. #i n c l u d e <pthread .h>
  10. s t a t i c i n t x = 0;
  11. s t a t i c void * a( void * arg ) {
  12. uns igned i n t i;
  13. f o r (i = 0; i < 50; i ++) {
  14. printf ("A: %d", x);
  15. x ++;
  16. printf (" -> %d\n", x);
  17. }r
  18. e t u r n NULL ;
  19. }
  20. s t a t i c void * b( void * arg ) {
  21. uns igned i n t i;
  22. f o r (i = 0; i < 50; i ++) {
  23. printf ("B: %d", x);
  24. x ++;
  25. printf (" -> %d\n", x);
  26. }r
  27. e t u r n NULL ;
  28. }
  29. i n t main () {
  30. pthread_t tid_a , tid_b ;
  31. pthread_create (& tid_a , NULL , a, NULL );
  32. pthread_create (& tid_b , NULL , b, NULL );
  33. pthread_join (tid_a , NULL );
  34. pthread_join (tid_b , NULL );
  35. r e t u r n 0;
  36. }
  37. }
  38. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(8,0): error CS1024: Wrong preprocessor directive
prog.cs(9,0): error CS1024: Wrong preprocessor directive
prog.cs(10,0): error CS1024: Wrong preprocessor directive
prog.cs(10,4): error CS1525: Unexpected symbol `a', expecting `,', `;', or `='
prog.cs(11,3): error CS0128: A local variable named `t' is already defined in this scope
prog.cs(11,4): error CS1525: Unexpected symbol `a', expecting `,', `;', or `='
prog.cs(13,4): error CS1525: Unexpected symbol `r', expecting `,', `;', or `='
prog.cs(13,26): error CS1525: Unexpected symbol `)', expecting `;' or `}'
prog.cs(18,2): error CS1525: Unexpected symbol `t', expecting `,', `;', or `='
prog.cs(20,5): error CS1519: Unexpected symbol `a' in class, struct, or interface member declaration
prog.cs(20,9): error CS1519: Unexpected symbol `i' in class, struct, or interface member declaration
prog.cs(20,16): error CS1519: Unexpected symbol `void' in class, struct, or interface member declaration
prog.cs(21,10): error CS1525: Unexpected symbol `i', expecting `,', `;', or `='
prog.cs(22,4): error CS1525: Unexpected symbol `r', expecting `,', `;', or `='
prog.cs(22,26): error CS1525: Unexpected symbol `)', expecting `;' or `}'
prog.cs(27,2): error CS1525: Unexpected symbol `t', expecting `,', `;', or `='
prog.cs(29,5): error CS1519: Unexpected symbol `t' in class, struct, or interface member declaration
prog.cs(35,4): error CS1525: Unexpected symbol `t', expecting `,', `;', or `='
prog.cs(38,0): error CS1525: Unexpected symbol `}'
Compilation failed: 19 error(s), 0 warnings
stdout
Standard output is empty