166  4.  ++-   

 

//    .

//     .

//    .
 

 pthread_inutex_t    . 
   pthread_mutex_t   ,  
.     
pthread_mutex_init ().    ,
      pthread_mutex_lock (),
pthread_mutex_unlock() Hpthread_mutex_destroy() .  -
 4.5  ,     ,
   4.6  ,      
      .   
.      4.7.    -
 "-"    .  4.5
 -"",   4.6  -"". 
     .

//  4.5

1 int isDirectory(string FileName)

2  {

3   struct stat StatBuffer;

4

5   Istat(FileName.c_str(),&StatBu?fer) ;

6   if((StatBuffer.sfc_mode & S_IFDIR) == -1)

7      {

8      cout  "    ."
 endl;

9      return (0) ;

10   }

11   else{

12      if(StatBuffer.st_mode & S_IFDIR){

13         return (1) ;

14      }

15   }

16   return (0) ;

17 }

18

19

20 int isRegular(string FileName)

21 {

22   struct stat StatBuffer;

23

24   Istat(FileName.c_str(),&StatBuffer) ;

25   if((StatBuffer.st_mode & S_IFDIR) == -1)

26   {

27      cout  "    ."
 endl ;

28      return (0) ;

29   }

30   else{

31      if(StatBuffer.st_mode & S_IFREG){

32         return (1) ;

33      }