#include <iostream>
#include <cstdlib>
#include <pthread.h>
using namespace std;
#define NUM_THREADS 5
void *PrintHello(void *threadid) {
long tid;
tid = (long)threadid;
cout << "Hello World! Thread ID, " << tid << endl;
pthread_exit(NULL);
}
int main () {
pthread_t threads[NUM_THREADS];
int rc;
int i;
for( i = 0; i < NUM_THREADS; i++ ) {
cout << "main() : creating thread, " << i << endl;
rc = pthread_create(&threads[i], NULL, PrintHello, (void *)i);
if (rc) {
cout << "Error:unable to create thread," << rc << endl;
exit(-1);
}
}
pthread_exit(NULL);
}
$gcc test.cpp -lpthread
main() : creating thread, 0
main() : creating thread, 1
main() : creating thread, 2
main() : creating thread, 3
main() : creating thread, 4
Hello World! Thread ID, 0
Hello World! Thread ID, 1
Hello World! Thread ID, 2
Hello World! Thread ID, 3
Hello World! Thread ID, 4
var proto = (document.location.protocol=='https:')?'https:':'http:';
var host = proto+'//widget.copiny.com';
document.write(unescape("%3Cscript src='" + host + "/static/js/newwidget.js' type='text/javascript'%3E%3C/script%3E"));
var copinyWidgetOptions = {
position: 'left',
color: '#1ba05c',
border: '#ffffff',
round: '0',
title: "\u0421\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438",
cache: "bf3b0dc169b4c5c175567223c5b2f69c\/bf3b0dc169b4c5c175567223c5b2f69c\/ejOwVXUxUHU0BJFOrkgkUMRQ1cISzDYFsyEiRmARCOmqDabckLSZIJEQbQZgthmYdASTFmqGtjmpaSUA",
positionMobile :'right',
colorMobile :'#1ba05c',
textMobile :"",
type: 'question',
community:13199
};
//вам нужно убрать этот вызов
//initCopinyWidget(copinyWidgetOptions);
//CopinyNewWidget.showTab();
function detectmob() {
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){
return true;
}
else {
return false;
}
}
if(!detectmob()){
//showtab widget
//и вызвать функцию отсюда
initCopinyWidget(copinyWidgetOptions);
CopinyNewWidget.showTab();
}