Skip to content

Instantly share code, notes, and snippets.

@stelleg
Created August 11, 2016 14:36
Show Gist options
  • Save stelleg/f49347bd0cc5f1cc1bec43583ba8e92b to your computer and use it in GitHub Desktop.
Save stelleg/f49347bd0cc5f1cc1bec43583ba8e92b to your computer and use it in GitHub Desktop.
qthreads test case
#include <qthread.h>
#include <qthread/sinc.h>
volatile int j = 0;
aligned_t task(void* arg){
j ++;
}
int main(){
qthread_initialize();
qt_sinc_t *sinc = qt_sinc_create(0, NULL, NULL, 0);
for(int i=0; i<10; i++){
qt_sinc_expect(sinc, 1);
qthread_spawn(task,
NULL,
0,
sinc,
0,
NULL,
NO_SHEPHERD,
QTHREAD_SPAWN_RET_SINC_VOID);
}
qt_sinc_expect(sinc, 10);
qt_sinc_wait(sinc, NULL);
return j;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment