requirements:
C language implements producer-consumer model
- student_queue queue
- producer thread
- consumer thread
question:
when getting data from the queue, student is not assigned after the student_queue_get () function is executed
- student is assigned correctly in the student_queue_get () function
- status when student is reassigned after student_queue_get () is executed ((Student student declaration)
look at the code:
- student_queue.c queue
void *thread_run(void *userdata){
for(;;){
Student student;
student_packet_get(&queue, &student);
LOGI("Student: { age: %d, name: %s}\n", student.age, student.name);// : age = 0, name =
}
}
int main() {
pthread_t thread;
pthread_create(&thread, NULL, thread_run, NULL);
}