70. {

71. perror( “thread2 sem_wait n” );

72. }

73.

74. if( g_Flag == 1 )

75. sem_post( &sem_syn );

76.

77. g_Flag = 2;

78.

79. if( sem_post( &sem_mutex ) != 0)

80. {

81. perror( “ thread2 sem_postn” );

82. }

83. printf( “ thread2 id: %u , g_Flag: %d n”, ( unsigned int )pthread_self(), g_Flag );

84. printf( “Leave thread2 nn” );

85.

86. pthread_exit(0);

87.}

责任编辑:ct

关于嵌入式技术就介绍完了,您有什么想法可以联系小编。