aboutsummaryrefslogtreecommitdiff
path: root/tests/glfw/mthello.c
blob: e12dea52551e999c650480363146f499f84d73ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;
}