Blame view

node_modules/fsevents/src/locking.cc 518 Bytes
aaac7fed   liuqimichale   add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  /*
  ** © 2014 by Philipp Dunkel <pip@pipobscure.com>
  ** Licensed under MIT License.
  */
  
  void FSEvents::lockingStart() {
    if (lockStarted) return;
    lockStarted = true;
    pthread_mutex_init(&lockmutex, NULL);
  }
  
  void FSEvents::lock() {
    if (!lockStarted) return;
    pthread_mutex_lock(&lockmutex);
  }
  
  void FSEvents::unlock() {
    if (!lockStarted) return;
    pthread_mutex_unlock(&lockmutex);
  }
  
  void FSEvents::lockingStop() {
    if (!lockStarted) return;
    lockStarted = false;
    
    pthread_mutex_destroy(&lockmutex);
  }