Commits

Anonymous committed 291a433

Implemented pthread_rwlock_fcfs_destroy.

  • Participants
  • Parent commits 83560ec

Comments (0)

Files changed (2)

File pthreads/rwlock.c

     return ret;
 }
 
+extern void pthread_rwlock_fcfs_destroy(pthread_rwlock_fcfs_t * rwlock)
+{
+#ifdef PTHREAD_RWLOCK_FCFS_DEBUG
+    char id[1] = "";
+#endif
+    /* Make sure no new threads are accepted */
+    rwlock->is_destroyed = 1;
+
+    /* Make sure all running threads are cleared up. */
+    pthread_rwlock_fcfs_gain_write(rwlock PTHREAD_RWLOCK_FCFS_DEBUG_CALL_ARGS);
+
+    pthread_rwlock_fcfs_release(rwlock PTHREAD_RWLOCK_FCFS_DEBUG_CALL_ARGS);
+
+    /* Now - destroy the lock. */
+    pthread_rwlock_fcfs_queue_destroy(rwlock->queue);
+    
+    free(rwlock);
+
+    return;
+}
+

File pthreads/test_rwlock.c

             pthread_mutex_unlock(&num_active_mutex);
         }
     }
+
+    pthread_rwlock_fcfs_destroy(mylock);
+
     return 0;
 }