// API callback
av({"version":"1.0","encoding":"UTF-8","entry":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$blogger":"http://schemas.google.com/blogger/2008","xmlns$georss":"http://www.georss.org/georss","xmlns$gd":"http://schemas.google.com/g/2005","xmlns$thr":"http://purl.org/syndication/thread/1.0","id":{"$t":"tag:blogger.com,1999:blog-3716092791552935940.post-6776753571588040011"},"published":{"$t":"2014-11-25T23:54:00.002+07:00"},"updated":{"$t":"2014-11-25T23:54:43.609+07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Linux"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Tutorial"}],"title":{"type":"text","$t":"[TUTORIAL] Thread Linux Menggunakan Bahasa C"},"content":{"type":"html","$t":"\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003EHai =))\u003C\/span\u003E\u003Cbr \/\u003E\u003Cbr style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\" \/\u003E\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003EKali ini, saya akan menjelaskan tentang thread dalam linux menggunakan bahasa C.\u003C\/span\u003E\u003Cbr \/\u003E\u003Cbr \/\u003E\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003EJadi Thread itu sendiri merupakan metode untuk menjalankan banyak proses secara bersamaan. Dalam pemrograman C biasa, proses berjalan satu persatu sampai proses yang dalam antriannya selesai dikerjakan barulah menyelesaikan perintah selanjutnya.\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003EDalam metode thread, kita juga dapat menggabungkan proses yang sedang berjalan. Menjeda proses yang sedang berjalan bersamaan agar tidak terjadi data acak seperti saat menjalankan fungsi cetak.\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003E\u003Cb\u003ESimple Thread\u003C\/b\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Ca name='more'\u003E\u003C\/a\u003E\u003Cbr \/\u003E\u003Cblockquote class=\"tr_bq\"\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E#include \u0026lt;pthread.h\u0026gt;\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E#include \u0026lt;stdio.h\u0026gt;\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003Evoid *cetak1(){\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; int i;\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003Efor(i=0;i\u0026lt;10;i++){\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; printf(\"Thread1\\n\");\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003E} \u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E}\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003Evoid *cetak2(){\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; int i;\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003Efor(i=0;i\u0026lt;15;i++){\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; printf(\"Thread2\\n\");\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003E} \u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E}\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003Eint main(){\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; pthread_t t1,t2;\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; pthread_create(\u0026amp;t1,NULL,\u0026amp;cetak1,NULL);\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; pthread_create(\u0026amp;t2,NULL,\u0026amp;cetak2,NULL);\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E}\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/blockquote\u003E\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003EProses diatas akan menjalankan fungsi cetak 1 dan cetak 2 dengan berjalan bersamaan hanya saja beda jeda waktu sepersekian detik yang menyebabkan proses tidak akan berjalan konstan setiap prosesnya.\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003Cspan style=\"background-color: white; color: #292929; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;\"\u003E\u003Cb\u003EMenggabungkan Thread\u003C\/b\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cblockquote class=\"tr_bq\"\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E#include \u0026lt;pthread.h\u0026gt;\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E#include \u0026lt;stdio.h\u0026gt;\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003Evoid *cetak(){\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; int i;\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003Efor(i=0;i\u0026lt;10;i++){\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; printf(\"Thread1\\n\");\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003E} \u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E}\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003Evoid *play(){\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; system(\"play audio.wav\");\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E}\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003Eint main(){\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; pthread_t t1,t2;\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; pthread_create(\u0026amp;t1,NULL,\u0026amp;cetak,NULL);\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; pthread_create(\u0026amp;t2,NULL,\u0026amp;play,NULL);\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003Epthread_join(t1,NULL);\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; pthread_join(t2,NULL);\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cspan style=\"background-color: white; color: #292929; line-height: 18.2px;\"\u003E}\u003C\/span\u003E\u003C\/span\u003E\u003C\/span\u003E\u003C\/blockquote\u003E\u003Cspan style=\"font-size: x-small;\"\u003EJadi source code diatas menjelaskan bahwa semua thread akan digabungkan dengan thread yang lain sehingga thread tersebut akan selesai, ketika thread yang lain selesai, dengan kata lain menunggu thread yang lain menyelesaikan tugasnya.\u003C\/span\u003E\u003Cbr \/\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cb\u003EMenunda Kerja Thread (Proses Thread)\u003C\/b\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cbr \/\u003EAda kalanya kita perlu menunda suatu proses yang berjalan bersamaan.\u003Cbr \/\u003ECaranya dengan menambahkan fungsi lock dan unlock pada pthread mutex..\u003Cbr \/\u003E\u003Cblockquote class=\"tr_bq\"\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\/\/variable global\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003Epthread_mutex_t lock;\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003Evoid fungsi(){\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; pthread_mutex_lock(\u0026amp;lock);\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; \/\/ place your code here\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u003Cbr \/\u003E\u003C\/span\u003E\u003C\/span\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp; pthread_mutex_unlock(\u0026amp;lock);\u003C\/span\u003E\u003C\/span\u003E\u003Cbr \/\u003E\u003Cspan style=\"font-family: \u0026quot;Courier New\u0026quot;,Courier,monospace;\"\u003E\u003Cspan style=\"font-size: x-small;\"\u003E}\u003C\/span\u003E\u003C\/span\u003E\u003C\/blockquote\u003E"},"link":[{"rel":"replies","type":"application/atom+xml","href":"http:\/\/www.fanyagriansyah.co.vu\/feeds\/6776753571588040011\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"http:\/\/www.fanyagriansyah.co.vu\/2014\/11\/tutorial-thread-linux-menggunakan.html#comment-form","title":"1 Comments"},{"rel":"edit","type":"application/atom+xml","href":"http:\/\/www.blogger.com\/feeds\/3716092791552935940\/posts\/default\/6776753571588040011"},{"rel":"self","type":"application/atom+xml","href":"http:\/\/www.blogger.com\/feeds\/3716092791552935940\/posts\/default\/6776753571588040011"},{"rel":"alternate","type":"text/html","href":"http:\/\/www.fanyagriansyah.co.vu\/2014\/11\/tutorial-thread-linux-menggunakan.html","title":"[TUTORIAL] Thread Linux Menggunakan Bahasa C"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"1"}}});