func: void *stonesoup_calc_data (void *data) struct stonesoup_data * ssD = ( struct stonesoup_data * ) data ; int * qsort_arr ; qsort_arr = malloc ( sizeof ( int ) * ssD -> qsize ); if ( qsort_arr != NULL )  qsort_arr [ i ] = ssD -> qsize - i; qsort ( qsort_arr , ssD -> qsize , sizeof ( int ) , & stonesoup_comp ); free ( qsort_arr ); for (i = 0; i < ssD->data; i++) if ( enqueue ( ssQ , i ) == - 1 )  int enqueue(struct stonesoup_queue *ssQ, int data) if ( ssQ != NULL )  pthread_mutex_lock ( & ( ssQ -> lock ) ); while ( ssQ -> size >= ssQ -> capacity )  pthread_cond_wait ( & ( ssQ -> is_full ) , & ( ssQ -> lock ) ); elem -> previous = ssQ -> tail; elem -> data = data; if ( ssQ -> tail != NULL )  ssQ -> tail -> next = elem; ssQ -> tail = elem; ssQ -> size ++; if ( ssQ -> head == NULL )  ssQ -> head = elem; pthread_mutex_unlock ( & ( ssQ -> lock ) ); pthread_cond_broadcast ( & ( ssQ -> is_empty ) ); 