mirror of
https://github.com/love2d/love.git
synced 2026-08-21 21:15:09 +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/stab.h
|
||||
./libraries/luasocket/libluasocket/wsocket.*
|
||||
./modules/sound/lullaby/FLACDecoder.*
|
||||
|
||||
@@ -29,19 +29,26 @@
|
||||
// STD
|
||||
#include <iostream>
|
||||
|
||||
// SDL
|
||||
#include <SDL_mutex.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
static SDL_mutex *gcmutex = 0;
|
||||
/**
|
||||
* Called when an object is collected. The object is released
|
||||
* once in this function, possibly deleting it.
|
||||
**/
|
||||
static int w__gc(lua_State * L)
|
||||
{
|
||||
if (!gcmutex)
|
||||
gcmutex = SDL_CreateMutex();
|
||||
Proxy * p = (Proxy *)lua_touserdata(L, 1);
|
||||
Object * t = (Object *)p->data;
|
||||
SDL_mutexP(gcmutex);
|
||||
if(p->own)
|
||||
t->release();
|
||||
SDL_mutexV(gcmutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -414,5 +421,4 @@ namespace love
|
||||
types.find(luaL_checkstring(L, idx), t);
|
||||
return t;
|
||||
}
|
||||
|
||||
} // love
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace love
|
||||
/**
|
||||
* Converts an object into another object by the specified function love.module.function.
|
||||
* The conversion function must accept a single object of the relevant type as a parameter,
|
||||
* and return one value. If the function does not exist (see luax_getfunction), an error is returned.
|
||||
* and returnone value. If the function does not exist (see luax_getfunction), an error is returned.
|
||||
*
|
||||
* Note that the initial object at idx is replaced by the new object.
|
||||
*
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ImageRasterizer.h"
|
||||
|
||||
#include <common/Exception.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user