diff dw.h @ 2474:a13e6db064f4

Android: Implement thread, semaphore, shared memory API functions. Implement dwmain() entrypoint and include dwtest.c in the build. Like on iOS dw_main() doesn't actually run the message loop... So wait for dw_main() to be called and return to the JVM.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 19 Apr 2021 23:06:25 +0000
parents aa420e366b2b
children 16d195d46f2a
line wrap: on
line diff
--- a/dw.h	Sun Apr 18 01:28:55 2021 +0000
+++ b/dw.h	Mon Apr 19 23:06:25 2021 +0000
@@ -729,6 +729,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <limits.h>
+#include <pthread.h>
 
 /* Can remove this for your port when you know where MAX_PATH is */
 #ifndef MAX_PATH
@@ -750,13 +751,25 @@
 typedef char CHAR;
 typedef unsigned UINT;
 typedef int INT;
-typedef void *HMTX;
-typedef void *HEV;
+typedef pthread_mutex_t *HMTX;
+typedef struct _dw_unix_event {
+    pthread_mutex_t mutex;
+    pthread_cond_t event;
+    pthread_t thread;
+    int alive;
+    int posted;
+} *HEV;
+typedef pthread_t DWTID;
+typedef void * HMOD;
+struct _dw_unix_shm {
+    int fd;
+    char *path;
+    int sid;
+    int size;
+};
 typedef void *HSHM;
-typedef void *HMOD;
 typedef void *HTREEITEM;
 typedef HWND HMENUI;
-typedef int DWTID;
 typedef unsigned long HICN;
 
 typedef struct _window_data {
@@ -1861,6 +1874,8 @@
    char **argv = _dw_convertargs(&argc, lpCmdLine, hInstance); \
    return _dwmain(argc, argv); } \
 int _dwmain(a, b)
+#elif defined(__ANDROID__)
+int dwmain(int argc, char *argv[]);
 #else
 #define dwmain(a, b) main(a, b)
 #endif