Differences

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

Link to this comparison view

app:laboratoare:04 [2024/10/29 02:37]
alexandru.bala [Variabile condiție]
app:laboratoare:04 [2024/10/29 02:44] (current)
alexandru.bala [Variabile condiție]
Line 478: Line 478:
  srand (time (NULL));  srand (time (NULL));
  for (i = 0; i < NUM_THREADS;​ i++) {  for (i = 0; i < NUM_THREADS;​ i++) {
- type = rand () % 2;+ type = i % 2;   // ar funcționa și rand () % 2 în loc de i % 2?
  if (type == CONSUMER) {  if (type == CONSUMER) {
  pthread_create (&​tid_v[i],​ NULL, consumer_func,​ NULL);  pthread_create (&​tid_v[i],​ NULL, consumer_func,​ NULL);
app/laboratoare/04.1730162279.txt.gz · Last modified: 2024/10/29 02:37 by alexandru.bala
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0