]> git.feebdaed.xyz Git - socialize.git/commitdiff
mod: cmd/rat-chat cmd/engine
authorseantywork <seantywork@gmail.com>
Tue, 18 Feb 2025 07:26:06 +0000 (16:26 +0900)
committerseantywork <seantywork@gmail.com>
Tue, 18 Feb 2025 07:26:06 +0000 (16:26 +0900)
Makefile
cmd/engine/main.c [new file with mode: 0644]
cmd/rat-chat/main.c [deleted file]

index 1bcd41c86ef601cc7f5709ac0287d726a2c232f0..1816403ffc5b7fc9f85df35b9f942083ef8b7bf3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -47,12 +47,12 @@ vendor:
 
 dev: $(OBJS) $(DEP_OBJS)
 
-       gcc $(GCC_DEV_FLAGS) $(INCLUDES) -o rat-chat.out cmd/rat-chat/main.c $(OBJS) $(DEP_OBJS) $(LIBS) 
+       gcc $(GCC_DEV_FLAGS) $(INCLUDES) -o engine.out cmd/engine/main.c $(OBJS) $(DEP_OBJS) $(LIBS) 
 
 
 release: $(OBJS) $(DEP_OBJS)
 
-       gcc $(GCC_REL_FLAGS) $(INCLUDES) -o rat-chat.out cmd/rat-chat/main.c $(OBJS) $(DEP_OBJS) $(LIBS) 
+       gcc $(GCC_REL_FLAGS) $(INCLUDES) -o engine.out cmd/engine/main.c $(OBJS) $(DEP_OBJS) $(LIBS) 
 
 
 
diff --git a/cmd/engine/main.c b/cmd/engine/main.c
new file mode 100644 (file)
index 0000000..6c3a564
--- /dev/null
@@ -0,0 +1,41 @@
+
+#include "rat-chat/sock/core.h"
+#include "rat-chat/front/core.h"
+
+#include "rat-chat/utils.h"
+FILE* LOGFP;
+
+pthread_mutex_t G_MTX;
+
+int main(){
+
+
+  srand((unsigned int)time(NULL));
+
+  LOGFP = fopen("log.txt","a");
+
+
+  pthread_t sock_tid;
+  pthread_t front_tid;
+
+  if (pthread_mutex_init(&G_MTX, NULL) != 0) { 
+      printf("mutex init has failed\n"); 
+      return -1; 
+  } 
+
+
+  pthread_create(&front_tid, NULL, (void*)front_listen_and_serve, NULL);
+
+  sleepms(500);
+
+  pthread_create(&sock_tid, NULL, (void*)sock_listen_and_serve, NULL);
+
+  sleepms(500);
+
+
+  pthread_join(front_tid, NULL);
+
+  fclose(LOGFP);
+
+
+}
\ No newline at end of file
diff --git a/cmd/rat-chat/main.c b/cmd/rat-chat/main.c
deleted file mode 100644 (file)
index 6c3a564..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-
-#include "rat-chat/sock/core.h"
-#include "rat-chat/front/core.h"
-
-#include "rat-chat/utils.h"
-FILE* LOGFP;
-
-pthread_mutex_t G_MTX;
-
-int main(){
-
-
-  srand((unsigned int)time(NULL));
-
-  LOGFP = fopen("log.txt","a");
-
-
-  pthread_t sock_tid;
-  pthread_t front_tid;
-
-  if (pthread_mutex_init(&G_MTX, NULL) != 0) { 
-      printf("mutex init has failed\n"); 
-      return -1; 
-  } 
-
-
-  pthread_create(&front_tid, NULL, (void*)front_listen_and_serve, NULL);
-
-  sleepms(500);
-
-  pthread_create(&sock_tid, NULL, (void*)sock_listen_and_serve, NULL);
-
-  sleepms(500);
-
-
-  pthread_join(front_tid, NULL);
-
-  fclose(LOGFP);
-
-
-}
\ No newline at end of file