Threading pool program with fixed thread_max

I am trying to make a simple HTTP/HTTPS service discovery in C.

For this app i use pthread as there is no other better cross platform options for this, but i get some strange errors.

PROBLEM1 : thread_submit has do be dynamically modified at the run time. Right now it is only accepting lvalue and it can only be modified from source code only.

int thread_max = 50; // how many checking threads to spawn [suggesting number between 4 and 8]
#define thread_submit 50 // how many thread submits, usually has to be lower or equal to thread_max

typedef struct Task {
    int id;
    char* ip;
    int port;
} Task;

Task taskQueue[thread_submit];
int taskCount = 0;

After a while (first for iteration) the program stops.

PROBLEM2 : after first iteration, program waits

int main()
{
    for(int this_port = 80; this_port <= 88; this_port++)
    {
        ...

        pthread_t thread_scan;
        pthread_t thread_read;
        pthread_create(&thread_scan, &attr, &run_fake_scan, NULL);
        pthread_create(&thread_read, &attr, &read_results, NULL);
        pthread_join(thread_scan, NULL);
        pthread_join(thread_read, NULL);
        pthread_attr_destroy(&attr);

        ...
    }
}

Output:

read_results -> Thread created no. 44
read_results -> Thread created no. 45
startThread -> i am here 1
read_results -> Thread created no. 46
startThread -> i am here 1
startThread -> i am here 1
read_results -> Thread created no. 47
read_results -> Thread created no. 48
read_results -> Thread created no. 49
startThread -> i am here 1
startThread -> i am here 1

It is stopping/waiting on pthread_mutex_lock(&mutexQueue); line, as if is infinitely waiting for mutex to get unlocked and never does that.

Full source code : https://pastebin.com/a6rtTBcX
Run code : https://www.onlinegdb.com/edit/EAou_Yzol

What am i doing wrong?

Thank you.