Playback starts YouTube’s embedded player (privacy-enhanced mode).
How to pass arguments to and get results from threads. (pthread_create, pthread_join)
ChannelJacob SorberDescription from the creator
Courses ➤ jacobsorber.thinkific.com
Website ➤ jacobsorber.com
---
This video builds on the last one, which showed you how to create threads. (youtu.be/uA8X5zNOGw8)
This video shows you how to pass arguments to your new threads and get the results that those threads produce.
***
Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.
About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.
More about me and what I do:
jacobsorber.com
people.cs.clemson.edu/~jsorber/
persist.cs.clemson.edu/
To Support the Channel:
+ like, subscribe, spread the word
+ contribute via Patreon --- [patreon.com/jacobsorber]
+ rep the channel with nerdy merch --- [teespring.com/stores/jacob-sorbers-store]
Source code is also available to Patreon supporters. --- [jsorber-youtube-source.herokuapp.com/]
Want me to review your code?
Email the code to [email protected]. Code should be simple and in one of the following languages: C, C++, python, java, ruby. You must be the author of the code and have rights to post it. Please include the following statement in your email: "I attest that this is my code, and I hereby give Jacob Sorber the right to use, review, post, comment on, and modify this code on his videos."
You can also find more info about code reviews here.
youtube.com/watch?v=k2K2HVg4Arc
About this tutorial
Jacob Sorber published this 4:13 video tutorial on October 25, 2019. It has been watched 105,859 times on YouTube.
- Channel
- Jacob Sorber
- Category
- Science & Technology
- Duration
- 4:13
- Published
- October 25, 2019
- Views
- 105,859
- Likes
- 2,503
Share
Further reading
-
c - Multiple arguments to function called by pthread_create()? - Stack ...
stackoverflow.com
Your structure should live at least as long as your thread. If you're creating a thread and returning from the function that called pthread_create(), the structure allocated on the stack may get overwritten by other dat…
-
c - Passing multiple arguments to threaded function from pthread_create ...
stackoverflow.com
Passing data on a stack to a thread is not in-and-of its self a bad thing -- it depends upon the context. In this case, I don't care that my main thread has to block until the worker thread is done. – Daniel Santos Apr…
-
c - pthread_create and passing an integer as the last argument - Stack ...
stackoverflow.com
On each iteration of the loop, you're allocating new memory, each with a different address, so the thing that gets passed to pthread_create() on each iteration is different, so none of your threads ends up trying to acc…
This tutorial in other languages
- FRComment transmettre des arguments et obtenir des résultats de discussions. (Pthread_create, pthread_join)
- ESCómo pasar argumentos y obtener los resultados de las discusiones. (Pthread_create, pthread_join)
- PTComo passar argumentos para e obter resultados de threads. (Pthread_create, pthread_join)
- ITCome passare gli argomenti da e per ottenere risultati da discussioni. (Pthread_create, pthread_join)
- DEWie Argumente zu übergeben und Ergebnisse aus Fäden erhalten. (Pthread_create, pthread_join)
- NLHoe maak je argumenten te passeren en resultaten te krijgen van de draden. (Pthread_create, pthread_join)
- RUКак передать аргументы и получить результаты от потоков. (Pthread_create, pthread_join)
- PLJak przekazać argumenty i uzyskać wyniki z wątków. (Pthread_create, pthread_join)
- JAどのように引数を渡すとスレッドから結果を取得します。 (pthread_createの、pthread_joinを)
- ARكيفية تمرير الوسائط إلى والحصول على النتائج من المواضيع. (pthread_create، pthread_join)
- HIकैसे करने के लिए तर्क गुजरती हैं और धागे से परिणाम प्राप्त करने के लिए। (Pthread_create, pthread_join)
- IDCara melewati argumen untuk dan mendapatkan hasil dari benang. (Pthread_create, pthread_join)