mirror of
https://github.com/love2d/love.git
synced 2026-08-21 13:09:56 +02:00
Added mutexes to the GC and made tip buildable again on linux
This commit is contained in:
@@ -20,3 +20,4 @@
|
|||||||
./modules/native/tcc/libtcc/coff.h
|
./modules/native/tcc/libtcc/coff.h
|
||||||
./modules/native/tcc/libtcc/stab.h
|
./modules/native/tcc/libtcc/stab.h
|
||||||
./libraries/luasocket/libluasocket/wsocket.*
|
./libraries/luasocket/libluasocket/wsocket.*
|
||||||
|
./modules/sound/lullaby/FLACDecoder.*
|
||||||
|
|||||||
@@ -29,19 +29,26 @@
|
|||||||
// STD
|
// STD
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
// SDL
|
||||||
|
#include <SDL_mutex.h>
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
{
|
{
|
||||||
|
static SDL_mutex *gcmutex = 0;
|
||||||
/**
|
/**
|
||||||
* Called when an object is collected. The object is released
|
* Called when an object is collected. The object is released
|
||||||
* once in this function, possibly deleting it.
|
* once in this function, possibly deleting it.
|
||||||
**/
|
**/
|
||||||
static int w__gc(lua_State * L)
|
static int w__gc(lua_State * L)
|
||||||
{
|
{
|
||||||
|
if (!gcmutex)
|
||||||
|
gcmutex = SDL_CreateMutex();
|
||||||
Proxy * p = (Proxy *)lua_touserdata(L, 1);
|
Proxy * p = (Proxy *)lua_touserdata(L, 1);
|
||||||
Object * t = (Object *)p->data;
|
Object * t = (Object *)p->data;
|
||||||
|
SDL_mutexP(gcmutex);
|
||||||
if(p->own)
|
if(p->own)
|
||||||
t->release();
|
t->release();
|
||||||
|
SDL_mutexV(gcmutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,5 +421,4 @@ namespace love
|
|||||||
types.find(luaL_checkstring(L, idx), t);
|
types.find(luaL_checkstring(L, idx), t);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // love
|
} // love
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "ImageRasterizer.h"
|
#include "ImageRasterizer.h"
|
||||||
|
|
||||||
#include <common/Exception.h>
|
#include <common/Exception.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user