arudradey's picture
download
raw
704 Bytes
#include <assert.h>
#include <emscripten/em_asm.h>
#include <stdio.h>
#include <pthread.h>
#include <math.h>
_Atomic int ret;
void* foo(void* arg) {
int len = MAIN_THREAD_EM_ASM_INT({
var elem = document.getElementById('elem');
window.almost_PI = 3.14159;
return elem.innerText.length;
});
double almost_PI = MAIN_THREAD_EM_ASM_DOUBLE({
// read a double from the main thread
return window.almost_PI;
});
printf("almost PI: %f\n", almost_PI);
assert(fabs(almost_PI - 3.14159) < 0.001);
ret = len;
return NULL;
}
int main() {
pthread_t t;
pthread_create(&t, NULL, foo, NULL);
pthread_join(t, NULL);
printf("ret: %d\n", ret);
assert(ret == 8);
return 0;
}

Xet Storage Details

Size:
704 Bytes
·
Xet hash:
69f682a1070383301ac6b8a5ef7f243211ba60bf2206445df9f727df2b8d73bc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.