if (!stw_dev)
return FALSE;
- pipe_mutex_lock( stw_dev->ctx_mutex );
+ stw_lock_contexts(stw_dev);
src = stw_lookup_context_locked( dhrcSource );
dst = stw_lookup_context_locked( dhrcDest );
(void) fuMask;
}
- pipe_mutex_unlock( stw_dev->ctx_mutex );
+ stw_unlock_contexts(stw_dev);
return ret;
}
if (!stw_dev)
return FALSE;
- pipe_mutex_lock( stw_dev->ctx_mutex );
+ stw_lock_contexts(stw_dev);
ctx1 = stw_lookup_context_locked( dhglrc1 );
ctx2 = stw_lookup_context_locked( dhglrc2 );
if (ctx1 && ctx2 && ctx2->st->share)
ret = ctx2->st->share(ctx2->st, ctx1->st);
- pipe_mutex_unlock( stw_dev->ctx_mutex );
+ stw_unlock_contexts(stw_dev);
return ret;
}
pfi = stw_pixelformat_get_info( iPixelFormat );
if (hShareContext != 0) {
- pipe_mutex_lock( stw_dev->ctx_mutex );
+ stw_lock_contexts(stw_dev);
shareCtx = stw_lookup_context_locked( hShareContext );
- pipe_mutex_unlock( stw_dev->ctx_mutex );
+ stw_unlock_contexts(stw_dev);
}
ctx = CALLOC_STRUCT( stw_context );
ctx->hud = hud_create(ctx->st->pipe, ctx->st->cso_context);
}
- pipe_mutex_lock( stw_dev->ctx_mutex );
+ stw_lock_contexts(stw_dev);
if (handle) {
/* We're replacing the context data for this handle. See the
* wglCreateContextAttribsARB() function.
ctx->dhglrc = handle;
- pipe_mutex_unlock( stw_dev->ctx_mutex );
+ stw_unlock_contexts(stw_dev);
+
if (!ctx->dhglrc)
goto no_hglrc;
if (!stw_dev)
return FALSE;
- pipe_mutex_lock( stw_dev->ctx_mutex );
+ stw_lock_contexts(stw_dev);
ctx = stw_lookup_context_locked(dhglrc);
handle_table_remove(stw_dev->ctx_table, dhglrc);
- pipe_mutex_unlock( stw_dev->ctx_mutex );
+ stw_unlock_contexts(stw_dev);
if (ctx) {
struct stw_context *curctx = stw_current_context();
if (!stw_dev)
return FALSE;
- pipe_mutex_lock( stw_dev->ctx_mutex );
+ stw_lock_contexts(stw_dev);
ctx = stw_lookup_context_locked( dhglrc );
- pipe_mutex_unlock( stw_dev->ctx_mutex );
+ stw_unlock_contexts(stw_dev);
if (!ctx)
return FALSE;
}
if (dhglrc) {
- pipe_mutex_lock( stw_dev->ctx_mutex );
+ stw_lock_contexts(stw_dev);
ctx = stw_lookup_context_locked( dhglrc );
- pipe_mutex_unlock( stw_dev->ctx_mutex );
+ stw_unlock_contexts(stw_dev);
if (!ctx) {
goto fail;
}
screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
stw_dev->max_2d_length = 1 << (stw_dev->max_2d_levels - 1);
- pipe_mutex_init( stw_dev->ctx_mutex );
+ InitializeCriticalSection(&stw_dev->ctx_mutex);
pipe_mutex_init( stw_dev->fb_mutex );
stw_dev->ctx_table = handle_table_create();
* Abort cleanup if there are still active contexts. In some situations
* this DLL may be unloaded before the DLL that is using GL contexts is.
*/
- pipe_mutex_lock( stw_dev->ctx_mutex );
+ stw_lock_contexts(stw_dev);
dhglrc = handle_table_get_first_handle(stw_dev->ctx_table);
- pipe_mutex_unlock( stw_dev->ctx_mutex );
+ stw_unlock_contexts(stw_dev);
if (dhglrc) {
debug_printf("%s: contexts still active -- cleanup aborted\n", __FUNCTION__);
stw_dev = NULL;
stw_framebuffer_cleanup();
pipe_mutex_destroy( stw_dev->fb_mutex );
- pipe_mutex_destroy( stw_dev->ctx_mutex );
+ DeleteCriticalSection(&stw_dev->ctx_mutex);
FREE(stw_dev->smapi);
stw_dev->stapi->destroy(stw_dev->stapi);