With this basic pthread code below, what is the method to convert pthread_create to fork() and achieve a similar outcome.
#include <stdio.h>
#include <pthread.h>
#include <semaphore.h> 
#include <unistd.h>
sem_t mutex; 
void* wait_t(void* a)
{
    (int)a--;
    if ((int)a < 0)
    {
        sem_wait(&mutex);
        printf("waiting\n");
    }
}
void* signal_t(void* a)
{
    (int)a++;
    if ((int)a <= 0)
    {
        printf("signal\n");
        sem_post(&mutex);
    }
}
int main()
{
    sem_init(&mutex, 0, 1);
    int i = -2;
    pthread_t t1, t2; 
    pthread_create(&t1, NULL, wait_t, i);
    pthread_create(&t2, NULL, signal_t, i); 
    pthread_join(t1, NULL);
    pthread_join(t2, NULL);
    exit(0); 
}
 
    