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

Add lock functions.

Add possibly-misguided ThReader structure.
parent 44cf0992
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,8 @@ extern "C" {
#include "textures.h"
#include "sclock.h"
#include <pthread.h>
#include <stdio.h>
#define MAXVAL 29
......@@ -230,6 +232,18 @@ enum FadeType {
F_SPHERICAL, F_PLANAR, F_CONSTANT, F_LINEAR, F_LREGION, F_KNEE2, F_KNEE12
};
typedef struct threader {
struct threader *next;
char *name;
pthread_t thread;
int enabled;
struct stuff *st;
int (*notify)( struct threader *, struct stuff *, void * );
void *data;
} ThReader;
typedef struct dyndata {
int enabled;
int slvalid;
......@@ -241,9 +255,13 @@ typedef struct dyndata {
int (*help)( struct dyndata *, struct stuff *, int verbose );
void (*free)( struct dyndata *, struct stuff * );
} DynData;
typedef int (*SpecksPickFunc)( struct stuff *, GLuint *hit, struct specklist *, int speckno );
#define MAXFILES 8
struct stuff {
......@@ -251,15 +269,17 @@ struct stuff {
struct specklist *sl; /* Current display = anima[curdata][curtime] */
/* shared with possible reader threads: */
pthread_mutex_t smut;
struct specklist **anima[MAXFILES]; /* anima[ndata][ntimes]: All data. Shared with reader threads. */
/* rest owned by display thread. */
char dataname[MAXFILES][12];
int ntimes, ndata;
int timeroom; /* number of slots allocated for:
* anima[0..ndata-1][0..timeroom-1]
* datafile[0..ndata-1][0..timeroom-1]
*/
/* rest owned by display thread. */
int curtime, curdata;
double currealtime;
SClock *clk; /* provider of time */
......@@ -492,8 +512,15 @@ extern void specks_current_frame( struct stuff *, struct specklist *sl );
extern void specks_reupdate( struct stuff *, struct specklist *sl );
extern void specks_datawait( struct stuff * );
extern void specks_lock( struct stuff * );
extern void specks_unlock( struct stuff * );
/* uses locking: */
extern struct specklist * specks_timespecks( struct stuff *, int dataset, int timestep );
extern struct specklist **specks_timespecksptr( struct stuff *, int dataset, int timestep );
extern void specks_insertspecks( struct stuff *, int dataset, int timestep, struct specklist * );
extern void specks_clearspecks( struct stuff *, int dataset, int timestep );
extern float display_time(void);
extern char *rejoinargs( int arg0, int argc, char **argv );
......
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