Open Source & Linux Lab

It's better when it's simple

User Tools

Site Tools


courses:high_performance_computing:producer_consumer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
courses:high_performance_computing:producer_consumer [2021/10/04 08:00] kelcourses:high_performance_computing:producer_consumer [2022/02/12 12:52] kel
Line 27: Line 27:
 <file cpp> <file cpp>
 #include <pthread.h> #include <pthread.h>
- 
-void read_values() { 
-  FILE* file = fopen("in.txt"); 
-  ... read(); 
-} 
  
 void* producer_routine(void* arg) { void* producer_routine(void* arg) {
Line 37: Line 32:
  
   // Read data, loop through each value and update the value, notify consumer, wait for consumer to process   // Read data, loop through each value and update the value, notify consumer, wait for consumer to process
 +  std::ifstream if("in.txt");
 +  // ...
 } }
  
courses/high_performance_computing/producer_consumer.txt · Last modified: 2024/03/04 02:19 by odoronin