I got this simple C program that uses pthreads.
I basically want to call my_function() once I'm 100% sure that my_thread() gets called and is executed.
I need to know how to synchronize the main() function and the my_thread() function.
Please note that the my_thread() never returns.
#include <stdio.h>
#include <pthread.h>
void  my_function (void);
void* my_thread (void* arg);
int main (int argc, char* argv[])
{
    int rc;
    pthread_t id;
    
    rc = pthread_create(&id, NULL, my_thread, NULL);
    if (rc != 0)
    {
        return -10;
    }
    
    
    /*
     * I wanna call my_function() once I'm 100% sure my_thread() gets called and being executed
     */
    
    /*
     * Synchronization code to add here:
     */     
    
    
    my_function();
    
    
    return 0;
}
void* my_thread (void* arg)
{
    
    /*
     * This pthread never returns
     */
     
    while (1)
    {
        /* stuff */
    };
    
}
void my_function (void)
{
    printf("Hello\n");
}
Thanks for your help.
 
    