Skip to content
Snippets Groups Projects
Commit 858e0444 authored by slevy's avatar slevy
Browse files

Use HAVE_PTHREAD_H -- conditionally have POSIX mutex.

parent ba634a87
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
extern "C" { extern "C" {
#endif #endif
#include "config.h"
#ifdef __APPLE__ #ifdef __APPLE__
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#else #else
...@@ -31,7 +33,9 @@ extern "C" { ...@@ -31,7 +33,9 @@ extern "C" {
#include "textures.h" #include "textures.h"
#include "sclock.h" #include "sclock.h"
#ifdef HAVE_PTHREAD_H
#include <pthread.h> #include <pthread.h>
#endif /*HAVE_PTHREAD_H*/
#include <stdio.h> #include <stdio.h>
...@@ -232,17 +236,15 @@ enum FadeType { ...@@ -232,17 +236,15 @@ enum FadeType {
F_SPHERICAL, F_PLANAR, F_CONSTANT, F_LINEAR, F_LREGION, F_KNEE2, F_KNEE12 F_SPHERICAL, F_PLANAR, F_CONSTANT, F_LINEAR, F_LREGION, F_KNEE2, F_KNEE12
}; };
typedef struct threader { /* async reader ops:
struct threader *next; * lock, unlock shared data (by reader and main)
char *name; * pause, resume thread (wait on condition variable) (by main)
pthread_t thread; * cancel read (by main)
int enabled; * set memory budget (by main)
struct stuff *st; * notify of change of timespan or whatever (by reader)
int (*notify)( struct threader *, struct stuff *, void * ); * import data (by reader)
void *data; * purge data (by reader)
} ThReader; */
typedef struct dyndata { typedef struct dyndata {
int enabled; int enabled;
...@@ -269,8 +271,10 @@ struct stuff { ...@@ -269,8 +271,10 @@ struct stuff {
struct specklist *sl; /* Current display = anima[curdata][curtime] */ struct specklist *sl; /* Current display = anima[curdata][curtime] */
/* shared with possible reader threads: */ /* shared with possible reader threads: */
pthread_mutex_t smut;
struct specklist **anima[MAXFILES]; /* anima[ndata][ntimes]: All data. Shared with reader threads. */ struct specklist **anima[MAXFILES]; /* anima[ndata][ntimes]: All data. Shared with reader threads. */
#ifdef HAVE_PTHREAD_H
pthread_mutex_t smut;
#endif
char dataname[MAXFILES][12]; char dataname[MAXFILES][12];
int ntimes, ndata; int ntimes, ndata;
...@@ -512,11 +516,13 @@ extern void specks_current_frame( struct stuff *, struct specklist *sl ); ...@@ -512,11 +516,13 @@ extern void specks_current_frame( struct stuff *, struct specklist *sl );
extern void specks_reupdate( struct stuff *, struct specklist *sl ); extern void specks_reupdate( struct stuff *, struct specklist *sl );
extern void specks_datawait( struct stuff * ); extern void specks_datawait( struct stuff * );
extern void specks_lock_init( struct stuff * );
extern void specks_lock( struct stuff * ); extern void specks_lock( struct stuff * );
extern void specks_unlock( struct stuff * ); extern void specks_unlock( struct stuff * );
/* uses locking: */ /* uses locking: */
extern struct specklist * specks_timespecks( struct stuff *, int dataset, int timestep ); extern struct specklist * specks_timespecks( struct stuff *, int dataset, int timestep );
extern void specks_ensuretime( struct stuff *, int dataset, int timestep );
extern void specks_insertspecks( struct stuff *, int dataset, int timestep, struct specklist * ); extern void specks_insertspecks( struct stuff *, int dataset, int timestep, struct specklist * );
extern void specks_clearspecks( struct stuff *, int dataset, int timestep ); extern void specks_clearspecks( struct stuff *, int dataset, int timestep );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment