* Write preliminary thread creation functions for Linux.
* Debug the Makefile
This commit is contained in:
jean.chalard
2009-05-23 04:44:44 +00:00
parent d7840821ad
commit 10aa8e32d9
4 changed files with 485 additions and 466 deletions

View File

@@ -7,7 +7,7 @@ GENERIC_OBJS = src/JApp.o src/JGBKFont.o \
src/JGE.o src/JGui.o src/JLBFont.o \
src/JGameObject.o src/JSpline.o src/JAnimator.o \
src/JResourceManager.o src/JFileSystem.o \
src/JNetwork.o src/JSocket.o \
src/JNetwork.o \
src/JParticle.o src/JParticleEmitter.o src/JParticleEffect.o \
src/JParticleSystem.o \
src/unzip/ioapi.o src/unzip/mztools.o src/unzip/unzip.o \
@@ -16,7 +16,7 @@ GENERIC_OBJS = src/JApp.o src/JGBKFont.o \
src/tinyxml/tinyxmlparser.o src/tinyxml/tinyxmlerror.o \
src/Encoding.o src/JTTFont.o \
src/JMD2Model.o src/JOBJModel.o src/vram.o
PSP_OBJS = src/JGfx.o src/JSfx.o src/JAudio.o src/JMP3.o src/decoder_prx.o src/main.o
PSP_OBJS = src/JSocket.o src/JGfx.o src/JSfx.o src/JAudio.o src/JMP3.o src/decoder_prx.o src/main.o
LINUX_OBJS = src/linux/JGfx.o src/linux/JSfx.o src/Xmain.o

View File

@@ -23,8 +23,10 @@ public:
int send(char * buffer, int length);
int connect(string serverIP = "");
static int isConnected();
#if defined (WIN32) || defined (LINUX)
static int net_thread(LPVOID param);
#if defined (WIN32)
static int net_thread(void* param);
#elif defined (LINUX)
static void* net_thread(void* param);
#else
static int net_thread(SceSize args, void *argp);
static int connect_to_apctl(int config);
@@ -32,8 +34,10 @@ public:
private:
#if defined (WIN32) || defined (LINUX)
#if defined (WIN32)
static DWORD netthread;
#elif defined (LINUX)
static pthread_t netthread;
#else
static int netthread;
#endif

View File

@@ -78,8 +78,8 @@ int JNetwork::send(char * buffer, int length){
#ifdef WIN32
int JNetwork::net_thread(LPVOID param)
#if defined (WIN32)
int JNetwork::net_thread(void* param)
{
do
{
@@ -88,18 +88,14 @@ int JNetwork::net_thread(LPVOID param)
if (JNetwork::serverIP.size()){
OutputDebugString(JNetwork::serverIP.c_str());
s->start_client(JNetwork::serverIP.c_str());
}else{
s->start_server(""); //IP address useless for server ?
}
}
while(0);
return 0;
}
int JNetwork::connect(string serverIP){
if(netthread) return 0;
@@ -110,11 +106,32 @@ int JNetwork::connect(string serverIP){
return netthread;
}
#elif defined (LINUX)
void* JNetwork::net_thread(void* param __attribute__((unused)))
{
do
{
JSocket::mInstance = new JSocket();
JSocket * s = JSocket::mInstance;
if (JNetwork::serverIP.size())
s->start_client(JNetwork::serverIP.c_str());
else
s->start_server(""); //IP address useless for server ?
}
while (0);
return NULL;
}
int JNetwork::connect(string serverIP)
{
if (netthread) return 0;
JNetwork::serverIP = serverIP;
return pthread_create(&netthread, NULL, net_thread, NULL);
}
#else
int net_thread(SceSize args, void *argp)
{
do
{
JSocket::mInstance = new JSocket();

View File

@@ -207,5 +207,3 @@ int JSocket::start_server(const char *szIpAddr)