Guest User

Untitled

a guest
Apr 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1.  
  2. Boolean WaitForMultipleObjects(int Count, void **Handle, boolean fWaitall, long
  3. msTimeOut)
  4. {
  5.  mutex_cond_t mutex_cond[Count];
  6.  for(i=0; i < Count; i++){
  7.    initialize the mutex and condition variable
  8.    Create a new mutex_cond object mutex_cond[i]
  9.    Add the mutex_cond object to the list of the Handle[i]
  10.  }
  11.  for(i=0; i < Count; i++){
  12.    Lock mutex_cond[i]->mutex
  13.    while (! Handle[i]->is_signaled) {
  14.      Wait until timeout on mutex_cond[i]->cond_var
  15.    }
  16.    UnLock mutex_cond[i]->mutex
  17.  }
  18.    for(i=0; i < Count; i++){
  19.    Delete mutex_cond[i] from Handle List
  20.  }
Add Comment
Please, Sign In to add comment