• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Why does thread just die if i dont set 'pthread_join'

#include  #include  #include   int count = 0; pthread_mutex_t MUTEX = PTHREAD_MUTEX_INITIALIZER;  void* func1(void* a){     pthread_mutex_lock(&MUTEX);     for(;count < 4;count++){                  printf("LOOP 1: %d
",count);         sleep(1);     }     pthread_mutex_unlock(&MUTEX); }  void* func2(void* a){     pthread_mutex_lock(&MUTEX);     for(;count < 8;count++){         printf("LOOP 2: %d
",count);         sleep(1);     }     pthread_mutex_unlock(&MUTEX); }  int main(){     pthread_t tid[2];     int a = 1;     int status;      if(pthread_create(tid,NULL,func1,(void*)&a))         printf("func1 error
");          if(pthread_create(tid+1,NULL,func2,(void*)&a))         printf("func2 error
");      //pthread_join(*tid, (void *) &status);      //pthread_join(*(tid+1), (void *) &status);  } 

simple code for testing how thread and mutex works.

If I run the code, it just terminates without showing anything (sometimes just one line "LOOP 1: 0")

If I uncomment

//pthread_join(*tid, (void *) &status);  //pthread_join(*(tid+1), (void *) &status);  

then it works well.

HOW this happens? someone please explain

Download script demo [LINK]
Download script demo [LINK 2] Download script demo [LINK 2]