make data access in the threads a bit more safe (note: probably will need some more safety measures later on)

This commit is contained in:
jp9000
2013-10-18 20:25:13 -07:00
parent ebbf4175d3
commit ae3cecf09f
6 changed files with 50 additions and 42 deletions

View File

@@ -110,11 +110,10 @@ int gs_create(graphics_t *pgraphics, const char *module,
struct gs_init_data *data)
{
int errcode = GS_ERROR_FAIL;
pthread_mutex_t mutex_init = PTHREAD_MUTEX_INITIALIZER;
graphics_t graphics = bmalloc(sizeof(struct graphics_subsystem));
memset(graphics, 0, sizeof(struct graphics_subsystem));
graphics->mutex = mutex_init;
pthread_mutex_init_value(&graphics->mutex);
graphics->module = os_dlopen(module);
if (!graphics->module) {