Diff of /pthread_cond_destroy.c [eb28d5] .. [6e3ac5] Maximize Restore

  Switch to unified view

a/pthread_cond_destroy.c b/pthread_cond_destroy.c
...
...
124
      return EINVAL;
124
      return EINVAL;
125
    }
125
    }
126
126
127
  if (*cond != PTHREAD_COND_INITIALIZER)
127
  if (*cond != PTHREAD_COND_INITIALIZER)
128
    {
128
    {
129
      EnterCriticalSection (&ptw32_cond_list_lock);
129
      ptw32_mcs_local_node_t node;
130
      ptw32_mcs_lock_acquire(&ptw32_cond_list_lock, &node);
130
131
131
      cv = *cond;
132
      cv = *cond;
132
133
133
      /*
134
      /*
134
       * Close the gate; this will synchronize this thread with
135
       * Close the gate; this will synchronize this thread with
...
...
152
        }
153
        }
153
    }
154
    }
154
    
155
    
155
      if (result != 0)
156
      if (result != 0)
156
        {
157
        {
157
          LeaveCriticalSection (&ptw32_cond_list_lock);
158
          ptw32_mcs_lock_release(&node);
158
          return result;
159
          return result;
159
        }
160
        }
160
161
161
      /*
162
      /*
162
       * Check whether cv is still busy (still has waiters)
163
       * Check whether cv is still busy (still has waiters)
...
...
211
        }
212
        }
212
213
213
      (void) free (cv);
214
      (void) free (cv);
214
    }
215
    }
215
216
216
      LeaveCriticalSection (&ptw32_cond_list_lock);
217
      ptw32_mcs_lock_release(&node);
217
    }
218
    }
218
  else
219
  else
219
    {
220
    {
221
      ptw32_mcs_local_node_t node;
220
      /*
222
      /*
221
       * See notes in ptw32_cond_check_need_init() above also.
223
       * See notes in ptw32_cond_check_need_init() above also.
222
       */
224
       */
223
      EnterCriticalSection (&ptw32_cond_test_init_lock);
225
      ptw32_mcs_lock_acquire(&ptw32_cond_test_init_lock, &node);
224
226
225
      /*
227
      /*
226
       * Check again.
228
       * Check again.
227
       */
229
       */
228
      if (*cond == PTHREAD_COND_INITIALIZER)
230
      if (*cond == PTHREAD_COND_INITIALIZER)
...
...
242
       * so assume it's in use.
244
       * so assume it's in use.
243
       */
245
       */
244
      result = EBUSY;
246
      result = EBUSY;
245
    }
247
    }
246
248
247
      LeaveCriticalSection (&ptw32_cond_test_init_lock);
249
      ptw32_mcs_lock_release(&node);
248
    }
250
    }
249
251
250
  return ((result != 0) ? result : ((result1 != 0) ? result1 : result2));
252
  return ((result != 0) ? result : ((result1 != 0) ? result1 : result2));
251
}
253
}