4.4px;"">Namun karena si D"7,lagu,dunia,yang,menjadi,miste...
Sunday, April 30, 2017

9 Kisah Persahabatan Sejati Antar HewanExfile4shared.blogspot.com, Agar menjadi pribadi yang baik, adalah benar harus memilih sahabat yang membawa kita ke arah kebaikan. Pergaulan yang buruk pasti akan memberi pengaruh tidak baik pula bagi kita.Namun, memilih sahabat atas dasar warna kulit, suku, tingkat...

5 Lukisan Telanjang yang Terkenal Termahal di Dunia Ini dia 5 lukisan bugil paling mahal di duniaDan ini bukan pornografi tapi melainkan karya artistik yang ditampilkan dengan cita rasa tinggi.5. NU COUCHE DE DOSLukisan ini dilukis pada tahun 1995 oleh Lucien Freud, dan dijual dengan harga $33.6 juta.4....
A Fitting Cue for Biosemi EEG CapUpon finishing measurement, if the size of a participants head falls on the border of the cap size reference, for example 56 cm of the red/blue (M-L). It may be a better choice to go for a small cap. That is to use the 54-58 cm red (M) cap, instead of using red/blue cap....
Posted by beni
April 30, 2017
6 Pthread condition variable in Linux
Condition variable one type of thread synchronization mechanism.
By using condition variable we can tell one thread that when to execute.
using pthread_cond_signal pass the signal to another thread, this signal can be catch by another thread using pthread_cond_wait.
Below program
- main thread will create two thread
- second thread will wait on pthread_cond_wait to get signal.
- first thread will increment the globalCount. When globalCount become 5 thread1 will send signal to thread2
- now thread2 will get signal and add 20 to globalCount and exited from thread handler
- then thread 1 increment the gloablCount until 15, and exited from thread handler function
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
int globalCount = 0;
pthread_mutex_t mutex;
pthread_cond_t condvar;
void *t1_fun(void *arg) //thread 1 handler function
{
int i = 0;
int t_num = (int)arg;
for (i=0; i<15; i++) {
pthread_mutex_lock(&mutex);
globalCount++;
if (globalCount == 5) {
pthread_cond_signal(&condvar);
printf("t1_fun(): thread %d, globalCount = %d Signaled ", t_num, globalCount);
}
printf("t1_fun(): thread %d, globalCount = %d ", t_num, globalCount);
pthread_mutex_unlock(&mutex);
sleep(1);
}
pthread_exit(NULL);
}
void *condVar_fun(void *arg) //thread 2 handler function
{
int t_num = (int)arg;
printf("Thread %d created and running ", t_num);
pthread_mutex_lock(&mutex);
pthread_cond_wait(&condvar, &mutex);
printf("condVar_fun(): Thread %d Condition signal received ", t_num);
globalCount += 20;
printf("condVar_fun(): Thread %d globalCount = %d ", t_num, globalCount);
pthread_mutex_unlock(&mutex);
pthread_exit(NULL);
}
int main(int argc, char *argv[])
{
pthread_t mythread1;
pthread_t mythread2;
pthread_attr_t myattr;
void *joinResult;
int x = 0;
int t_arg = 1;
pthread_attr_init(&myattr);
pthread_attr_setdetachstate(&myattr, PTHREAD_CREATE_JOINABLE);
pthread_mutex_init(&mutex, NULL);
pthread_cond_init (&condvar, NULL);
if((pthread_create(&mythread1, &myattr, t1_fun, (void*)t_arg) != 0)){
printf("Error, thread not created properly ");
return 1;
}
t_arg = 2;
if((pthread_create(&mythread2, &myattr, condVar_fun, (void*)t_arg) != 0)){
printf("Error, thread not created properly ");
return 1;
}
pthread_attr_destroy(&myattr);
if(pthread_join(mythread1, &joinResult) != 0 ){
printf("Error pthread join ");
return 1;
}
printf("Main : Thread1 joined with result of %d ", (int)joinResult);
if
Posted by beni in 5, coba, dan, harus, kacamata, kamu, reality, terbaik, terbaru, virtual, yang |
April 30, 2017

5 Kacamata Virtual Reality Terbaru dan Terbaik yang Harus Kamu CobaPesatnya perkembangan teknologi ternyata juga mempengaruhi dunia game. Saat ini, banyak perusahaan yang tengah mengembangkan berbagai teknologi virtual reality, salah satunya adalah perangkat berbentuk kacamatavirtual...

A guide to install Ubuntu ServerThis installation of Ubuntu Server is performed on a PC with an optical drive, but you can alternatively use a USB flash drive too to boot into Ubuntu Server. The how-to to use a USB for installing any version of Linux is described step-by-step here.Prior to the boot...

A Day That You ForgetSeorang kepala pelayan berseragam rapi dengan jas hitam dan kemeja putihnya, Alfred, bertanya kepada tuannya, �Apa Anda yakin hanya akan pergi berempat saja, Tuan Ryuki?��Tentu saja, Alfred,� jawab ayah dari dua orang anak dan suami dari seorang istri keluarga bangsawan itu. �Kau...
Search
Blog Archive
-
2021
(1060)
- December (48)
- November (104)
- October (95)
- September (82)
- August (102)
- July (95)
- June (91)
- May (98)
- April (86)
- March (85)
- February (73)
- January (101)
-
2020
(833)
- December (98)
- November (86)
- October (81)
- September (87)
- August (95)
- July (83)
- June (85)
- May (117)
- April (101)
-
2017
(922)
- June (304)
- May (315)
-
April
(302)
- 4.4px;"">Namun karena si D"
- 560 Servir
- 9 Kisah Persahabatan Sejati Antar Hewan
- 551 Depois que morremos
- 5 Lukisan Telanjang yang Terkenal Termahal di Dunia
- A Fitting Cue for Biosemi EEG Cap
- 6 Pthread condition variable in Linux
- 5 Kacamata Virtual Reality Terbaru dan Terbaik yan...
- A guide to install Ubuntu Server
- ning
- 570 Uns tirados outros deixados
- A Day That You Forget
- 500 Mile May
- 5 Things to consider when buying a computer Mambo ...
- A Breaking News ! We will also Post Shows of UFC T...
- 60 Crazy and Freak Cartoon Characters
- 9 Good CD and DVD Burning Tools for Ubuntu Linux
- 5 Best Wolfram Alpha widgets for your website
- 7 Antivirus Terbaik tahun 2011
- 550 O anonimo e Lazaro
- 8 Ball Pool FREE DOWNLOAD for PC Windows XP 7 8 10...
- 5 Hewan Dengan Suara Terkeras
- 543 Administradores de Deus
- 7 Wonders 240x320 java game for Nokia Asha Phones
- style="""
- A fix to Windows 2008 R2 and Solaris 10 BSOD and K...
- 504 Encurvados
- 9 Best Mobile Marketing Tips for Small Businesses
- 502 Todos iguais
- 5 Super Pegadinhas para você pregar no PC do seu a...
- 8StartButton v2 2 1 Serial
- 5 Beautiful Plank Themes
- 538 O Pai Prodigo
- 539 Perdido ou Achado
- 600 Kantai Collection part 1
- 596 Os filhos da ressurreicao
- 544 Job Vacancies in APSRTC
- 68 Packs de Brushes para Photoshop
- 5 Apps to Increase Your IQ – Android iOS
- 7 Tips hemat tampil Modis ala Artis
- 7 Pilihan Aplikasi Edit Video Terbaik
- A Monster Calls MP4 Subtitle Indonesia
- 8x8 VoIP Test
- 8 Manfaat Cabe
- 911 Operator PC Full Game Download
- 50 Cent Has Nasty Words For Diddy And Kanye West!
- A new challenge Webdetails joins Pentaho
- 7 000 Toques Polifonicos
- 6 Smartphone Terbaru Di Tahun 2016
- A Caveat of ADD
- 5 Step How to Install LibreOffice on Kali Linux
- 5 fakta terselubung tentang otak
- 50 High Quality Android Wallpapers
- 6 effective money making tips
- 6 Major Differences between Tracfone Android and N...
- 99th Post on 2012
- 5 Game Untuk Belajar Mengetik
- 5 Tempat Terlarang Menyimpan Ponsel
- A config m4 generator in m4
- 50 years Update 8 3 Free Download
- 8ball pool hack tools and mod game
- 5G field test hits a blistering 3 6Gbps data trans...
- A Collection of Reviews Tutorials About Desktop En...
- 7 keajaiban dunia ndeso by Tukulnesia
- A História da Internet
- 9 benda termahal di dunia
- A fan slid in front of Zlatan Ibrahimovic last nig...
- 50 kata kata mutiara dalam anime naruto
- 6 Reasons to Run a Bitcoin Full Node
- 573 Batendo no peito alheio
- 7 Kehebohan Seputar Vampir
- A little scoop from Anna Torv
- gn: justify;"">(i)
- 700 trò 312 MB có 1 ko 2
- A história de um otaku depressivo de OMORI
- 8 Registry Hacks to Tweak Your Windows PC
- 7 Degrees of MOOC
- 520 Desculpas
- 7 most useful Apps for Making appealing summary An...
- 5 Times JRPGs Kicked My Ass
- A Good Day To Die Hard 2013 720p Dual Audio Englis...
- ernet. Those are da"
- 8 Hour Maintenance Tommorow
- 9 Effective Tips for New Freelancers
- A New Battery Monitor for Ubuntu with Clever Notif...
- 537 Uma moeda nas trevas
- 5 things you didnt or did know about Ubuntu
- G4uI+BO"
- 8 BALL POOL MULTIPLAYER HACK 2012 FREE DOWNLOAD
- 5 Software Wajib Anak Arsitek
- 9 Manfaat Kesehatan Rajin Pijat Tubuh
- nbsp;unshift"
- A Gentle Reminder to Dan Haley of Athenahealth on ...
- A few things that made my 2016 interesting
- 50 Cents Pilot is our hot new video on Spanking New
- 579 Muitas vezes mais
- 556 Perdão
- 585 Na esfera do Reino
- 5 Lakh differently abled to be skill ready by ’18
- a little bit of Braun in this Pentax
- March (1)