aboutsummaryrefslogtreecommitdiff
path: root/tests/glfw/mthello.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/glfw/mthello.c')
-rw-r--r--tests/glfw/mthello.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/glfw/mthello.c b/tests/glfw/mthello.c
new file mode 100644
index 00000000..e12dea52
--- /dev/null
+++ b/tests/glfw/mthello.c
@@ -0,0 +1,48 @@
+//========================================================================
+// This is a small test application for GLFW.
+// The program prints "Hello world!", using two threads.
+//========================================================================
+
+#include <stdio.h>
+#include <GL/glfw.h>
+
+
+//========================================================================
+// HelloFun() - Thread function
+//========================================================================
+
+void GLFWCALL HelloFun( void *arg )
+{
+ // Print the first part of the message
+ printf( "Hello " );
+}
+
+
+//========================================================================
+// main() - Main function (main thread)
+//========================================================================
+
+int main( void )
+{
+ GLFWthread thread;
+
+ // Initialise GLFW
+ if( !glfwInit() )
+ {
+ return 0;
+ }
+
+ // Create thread
+ thread = glfwCreateThread( HelloFun, NULL );
+
+ // Wait for thread to die
+ glfwWaitThread( thread, GLFW_WAIT );
+
+ // Print the rest of the message
+ printf( "world!\n" );
+
+ // Terminate GLFW
+ glfwTerminate();
+
+ return 0;
+}