Commits

Anonymous committed 88fd064

Removed the .h files in the root directory. Mow there's only one copy of them.

Comments (0)

Files changed (3)

pthreads/CMakeLists.txt

 TARGET_LINK_LIBRARIES (test_rwlock pthread_rwlock_fcfs)
 
 INSTALL(
-    TARGETS ${FREECELL_SOLVER_LIBS}
-    DESTINATION "lib"
-)
-
-IF (WIN32 AND NOT UNIX)
-    # This is so on Windows, the .dll's will be installed in the bin/
-    # directory as well where the Freecell Solver command-line utilities
-    # will be able to find them.
-
-    INSTALL(
-        TARGETS "freecell-solver"
-        DESTINATION "bin"
-    )
-ENDIF (WIN32 AND NOT UNIX)
-
-INSTALL(
     FILES
         "AUTHORS"
         "COPYING"
 
 INSTALL(
     FILES
-        "rwlock_fcfs.h"
-        "rwlock_fcfs_queue.h"
+        "pthread/rwlock_fcfs.h"
+        "pthread/rwlock_fcfs_queue.h"
     DESTINATION
         "include/pthread"
 )

pthreads/rwlock_fcfs.h

-#ifndef __PTHREAD_RWLOCK_FCFS_H
-#define __PTHREAD_RWLOCK_FCFS_H
-
-#include <pthread.h>
-
-#include <pthread/rwlock_fcfs_queue.h>
-
-/* This is the struct that is pointed to by the elements of the queue of
- * the FCFS RWLock
- * */
-struct pthread_rwlock_fcfs_item_struct
-{
-    /* A condition variable to wake up the threads that waits upon this item */
-    pthread_cond_t cond;
-    /* A flag that specifies if it's a reader or a writer */
-    int is_writer;
-    /* A flag that disables this item */
-    int is_disabled;
-    /* An integer specifiying how many threads are waiting on it */
-    int num_threads;
-    /* A flag that indicates if the first thread in the pack has already
-     * been accepted. (Used only for a writers' pack */
-    int was_first_thr_accepted;
-};
-
-typedef struct pthread_rwlock_fcfs_item_struct pthread_rwlock_fcfs_item_t;
-
-/* The RWLock Struct */
-struct pthread_rwlock_fcfs_struct
-{
-    /* The queue that will be managed */
-    pthread_rwlock_fcfs_queue_t * queue;
-    /* The number of readers that are using the RWLock at the moment */
-    int num_readers;
-    /* Specifies if there is a writer locking the RWLock */
-    int is_writer;
-    /* A mutex to make sure no two threads _modify_ the RWLock struct
-     * at the moment */
-    pthread_mutex_t mutex;
-
-    /* A flag that indicates that no new threads should be accepted */
-    int is_destroyed;
-};
-
-typedef struct pthread_rwlock_fcfs_struct pthread_rwlock_fcfs_t;
-
-/************** Functions ***********/
-
-#ifdef PTHREAD_RWLOCK_FCFS_DEBUG
-#define PTHREAD_RWLOCK_FCFS_DEBUG_ARGS , char * id
-#define PTHREAD_RWLOCK_FCFS_DEBUG_CALL_ARGS , id
-#else
-#define PTHREAD_RWLOCK_FCFS_DEBUG_ARGS
-#define PTHREAD_RWLOCK_FCFS_DEBUG_CALL_ARGS
-#endif
-
-/*
- * Allocate a new FCFS RWLock
- * */
-extern pthread_rwlock_fcfs_t * pthread_rwlock_fcfs_alloc(void);
-
-/*
- * Wait indefinitely until a read access to the lock is granted.
- * */
-extern int pthread_rwlock_fcfs_gain_read(pthread_rwlock_fcfs_t * rwlock PTHREAD_RWLOCK_FCFS_DEBUG_ARGS);
-
-/*
- * Wait indefinitely until a write access to the lock is granted.
- * */
-extern int pthread_rwlock_fcfs_gain_write(pthread_rwlock_fcfs_t * rwlock PTHREAD_RWLOCK_FCFS_DEBUG_ARGS);
-
-/*
- * Release a previously gained read or write access
- * */
-extern void pthread_rwlock_fcfs_release(pthread_rwlock_fcfs_t * rwlock PTHREAD_RWLOCK_FCFS_DEBUG_ARGS);
-
-/*
- * Destroy the RWLock
- * */
-extern void pthread_rwlock_fcfs_destroy(pthread_rwlock_fcfs_t * rwlock);
-
-/*
- * Wait until a certain time (abstime) to get a read access. If it is
- * not given, continue_callback is called and asks whether to continue
- * or not.
- *
- * If it wishes to continue, it is responsible for setting the new abstime.
- *
- * context is the context variable for continue_callback
- *
- * */
-extern int pthread_rwlock_fcfs_timed_gain_read(
-        pthread_rwlock_fcfs_t * rwlock,
-        const struct timespec * abstime,
-        int (*continue_callback)(void * context),
-        void * context
-        PTHREAD_RWLOCK_FCFS_DEBUG_ARGS
-        );
-
-/*
- * Wait until a certain time (abstime) to get a write access. If it is not
- * given, continue_callback is called and asks whether to continue or not.
- *
- * If it wishes to continue, it is responsible for setting the new abstime.
- *
- * context is the context variable for continue_callback
- *
- * */
-extern int pthread_rwlock_fcfs_timed_gain_write(
-        pthread_rwlock_fcfs_t * rwlock,
-        const struct timespec * abstime,
-        int (*continue_callback)(void * context),
-        void * context
-        PTHREAD_RWLOCK_FCFS_DEBUG_ARGS
-        );
-
-/*
- * Attempt to gain a read access. If it is not given immidiately it returns an
- * error code other than 0.
- *
- * Else, it returns 0
- * */
-extern int pthread_rwlock_fcfs_try_gain_read(pthread_rwlock_fcfs_t * rwlock PTHREAD_RWLOCK_FCFS_DEBUG_ARGS);
-
-
-/*
- * Attempt to gain a write access. If it is not given immidiately it returns an
- * error code other than 0.
- *
- * Else, it returns 0
- * */
-extern int pthread_rwlock_fcfs_try_gain_write(pthread_rwlock_fcfs_t * rwlock PTHREAD_RWLOCK_FCFS_DEBUG_ARGS);
-
-
-#endif /* #ifndef __PTHREAD_RWLOCK_FCFS_H */
-
-

pthreads/rwlock_fcfs_queue.h

-
-
-#ifndef __PTHREAD_RWLOCK_FCFS_QUEUE_H
-#define __PTHREAD_RWLOCK_FCFS_QUEUE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define IP_NOISE_MESSAGE_BUFSIZE 0x20000
-
-#ifndef __KERNEL__
-
-struct pthread_rwlock_fcfs_queue_item_struct
-{
-    void * data;
-    struct pthread_rwlock_fcfs_queue_item_struct * next;
-};
-
-typedef struct pthread_rwlock_fcfs_queue_item_struct pthread_rwlock_fcfs_queue_item_t;
-
-struct pthread_rwlock_fcfs_queue_struct
-{
-    pthread_rwlock_fcfs_queue_item_t * head;
-    pthread_rwlock_fcfs_queue_item_t * tail;
-
-    int num_msgs;
-};
-
-typedef struct pthread_rwlock_fcfs_queue_struct pthread_rwlock_fcfs_queue_t;
-
-extern pthread_rwlock_fcfs_queue_t * pthread_rwlock_fcfs_queue_alloc(void);
-
-extern void pthread_rwlock_fcfs_queue_destroy(pthread_rwlock_fcfs_queue_t * queue);
-
-extern void * pthread_rwlock_fcfs_queue_dequeue(pthread_rwlock_fcfs_queue_t * queue);
-
-extern void * pthread_rwlock_fcfs_queue_peak(pthread_rwlock_fcfs_queue_t * queue);
-
-extern void pthread_rwlock_fcfs_queue_enqueue(pthread_rwlock_fcfs_queue_t * queue, void * msg);
-
-extern int pthread_rwlock_fcfs_queue_is_empty(pthread_rwlock_fcfs_queue_t * queue);
-
-extern void * pthread_rwlock_fcfs_queue_peak_tail(pthread_rwlock_fcfs_queue_t * queue);
-
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* #ifndef __PTHREAD_RWLOCK_FCFS_QUEUE_H */
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.