Комментарии:
pthread_join(&newthread,NULL) gives me error so i used pthread_join(newthread,NULL) and it works. Can anyone explain why it works here but does not work in my case. Thankyou.
ОтветитьThank you. This made my understanding about threads so much clear.
ОтветитьSo is this all happening in parallel? The processor doesn't switch from thread1 to thread2 because of the sleep?
ОтветитьHi Jacob,
I'm an embedded systems engineer and would like to do more work to understand threadding in Windows environement.
Any chance you could do a tutorial on MinGW / MSYS and to explain win32 vs posix threads and SEH vs SJLJ exception models, etc. that would be a guide for a newbie.
Kind regards, I love the videos
I'm using your video to learning english😂😂, and programming skills
ОтветитьExcellent work
ОтветитьGreat Video, Well Understood👍.
ОтветитьCan we make a thread wait for other thread to complete it's execution by
pthread_join
Or it is specifically used in main function only
kan itj å progge du jacob!
ОтветитьExtremely powerful video
ОтветитьIs this relevant for c++ or is there a different more popular tool for it?
ОтветитьHey
I’m at last year of my computer science bachelor .
I just want to say Thank youuuu for your videos they help me a lot ❤️
GOLD! ty so much
ОтветитьPerfect, Perfect, Perfect, Perfect,Perfect, Perfect,Perfect,Perfect,Perfect,Perfect !!!
ОтветитьThanks, Jacob!
ОтветитьAmazing video, simple and easy.
ОтветитьI hope this will be a good stepping stone for me to transition to odersky's parallel programming course on Coursera. That course really went over my head
ОтветитьIf you put the pthread_create function after the your_turn function would that not allow the my_turn function inside pthread_create to terminate before main terminated ? you'd then have output like "your turn" , "my turn my turn" , etc. etc. or would you just get "your turn , your turn , your turn" followed by a string of 5 "my turn" ? btw , pthread looks like a really bad idea ! Actually you know what ? I'm going to wait till I start coding C and just try things out and isn't that always the best way anyway ? Thanks for your great videos .
Ответитьyou are the best !
Ответитьwhat kinda font do you use? and vs code theme?
ОтветитьMaybe a "cleaner" design would be to have the main thread creating 2 different threads - one running the "yourturn" function and one running "myturn" - , then joining both of them?
Somehow, the asymmetry in calling one function within the main thread and one in a seperate thread, when both are conceptually doing the same (just with different strings) feels "wrong" to me.
(Although I'm of course fully aware that this is just meant as a very basic example.)
very helpful, thankyou!
ОтветитьI accidentally crashed my computer once by running a program that I wrote which had an infitie loop which produced threads. This description of what I wrote isn't quite correct but you get the point of more or less what I did.
ОтветитьAwesome class, thanks a lot!
Ответитьyou have to go over the functions properly, what is pthread_t? what is pthread_create? what are all the parameters? that's what i came to learn and i didn't get that. you just went over one example and with bare minimum information about it. it's just critique, i hope you implement in future videos.
ОтветитьDoes this work on Windows?
ОтветитьIf this channel doesnt get 1M subs till summer, I will be sad. Great videos Jacob!
ОтветитьLove how people like you make programming easier to learn for the rest of us. Thanks!
ОтветитьJacobSorber is a great C language teacher. I’m learning lots of useful programming techniques. Thanks
ОтветитьThread is one the scary topic to me. Thank you for explaining it such an easy way 😊
Ответитьthread.c:15:22: warning: unused parameter 'arg' [-Wunused-parameter]
void* myTurn (void * arg) {
Paramater void *myTurn (void * arg) not use, Why?
How do I stop a single thread from terminating within its threaded function until a certain condition is met or until the parent thread calls pthreads_join?
ОтветитьMost people: "I hated math in high school, why did I have to memorize the quadratic formula? What the heck is an imaginary number?"
Computer science majors: "...I have seen things. Things I can't unsee. Things like void *(*start_routine)(void*) ."
After creating a thread how long does it last? Until we call pthread_kill, pthread_cancel or pthread_join?
Ответитьhow do I install 3rd party libraries for codeblocks? is there any tutorial?
ОтветитьHey jacob, I was trying to combine your threads and signals videos and I've run into a question.
Whenever I press <CTRL> + C, I noticed that the next iteration of the "my turn" loop starts without waiting the full 2 seconds. I hope that makes sense how I described it. In order to keep this from happening, I thought that making a separate thread with the signal handler would solve this, but it still looks like SIGINT triggers the "my turn" loop in main. I don't really have an idea why this would happen. It seems that the handler and main are two separate entities, so the signal should not have an effect on main. If you have a second I'd appreciate any explanation you have. Thanks!
lol why u gotta make it badass now i wanna learn more about c now
ОтветитьGreat video! The second example is more intuitive.
ОтветитьExcellent again
Ответитьtip: Knock speed down to .75, flys through the coding part
Ответитьi had to add the "-lpthread" to get mine to compile using gcc
ОтветитьAdd the -lpthread flag to your gcc command in Linux.
ОтветитьMom, I have fallen in love with a man...
Ответитьif apt had a face, that would be you. Thank you
ОтветитьAmazing! Thanks bro. I spent 3 hours with my professor trying to explain that and he faild. You did it in 6 minutes! keep it up. Thanks
ОтветитьI tried this, but in my case, using CYGWIN GCC, I had to flush out the stdout after printf, otherwise it did not print anything. If you can give some insight would be great.
Ответить