summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/array.h16
-rw-r--r--libdimension/dimension/progress.h3
2 files changed, 4 insertions, 15 deletions
diff --git a/libdimension/dimension/array.h b/libdimension/dimension/array.h
index 1c8f601..5d5e50e 100644
--- a/libdimension/dimension/array.h
+++ b/libdimension/dimension/array.h
@@ -32,9 +32,6 @@
typedef struct {
void *ptr;
size_t obj_size, length, capacity;
-
- /* Synchronicity control (pointer so it's not const) */
- pthread_rwlock_t *rwlock;
} dmnsn_array;
/* Array allocation never returns NULL - if dmnsn_new_array returns, it
@@ -42,24 +39,13 @@ typedef struct {
dmnsn_array *dmnsn_new_array(size_t obj_size);
void dmnsn_delete_array(dmnsn_array *array);
-/* Thread-safe atomic array access */
-
void dmnsn_array_push(dmnsn_array *array, const void *obj);
void dmnsn_array_pop(dmnsn_array *array, void *obj);
void dmnsn_array_get(const dmnsn_array *array, size_t i, void *obj);
void dmnsn_array_set(dmnsn_array *array, size_t i, const void *obj);
+void *dmnsn_array_at(dmnsn_array *array, size_t i);
size_t dmnsn_array_size(const dmnsn_array *array);
void dmnsn_array_resize(dmnsn_array *array, size_t length);
-/* Non-atomic operations for manual locking */
-void *dmnsn_array_at(dmnsn_array *array, size_t i);
-size_t dmnsn_array_size_unlocked(const dmnsn_array *array);
-void dmnsn_array_resize_unlocked(dmnsn_array *array, size_t length);
-
-/* Manual locking */
-void dmnsn_array_rdlock(const dmnsn_array *array);
-void dmnsn_array_wrlock(dmnsn_array *array);
-void dmnsn_array_unlock(const dmnsn_array *array);
-
#endif /* DIMENSION_ARRAY_H */
diff --git a/libdimension/dimension/progress.h b/libdimension/dimension/progress.h
index 7958ab9..57a38b6 100644
--- a/libdimension/dimension/progress.h
+++ b/libdimension/dimension/progress.h
@@ -44,6 +44,9 @@ typedef struct {
/* The worker thread */
pthread_t thread;
+ /* Read-write synchronization */
+ pthread_rwlock_t *rwlock;
+
/* Condition variable for waiting for a particular amount of progress */
pthread_cond_t *cond;
pthread_mutex_t *mutex;