int main() {
Fl::lock();
/* run thread */
while (Fl::wait() > 0) {
if (Fl::thread_message()) {
/* process your data */
}
}
}
//////////////
void *msg; // "msg" is a pointer to your message
Fl::awake(msg); // send "msg" to main thread
//////////////
void do_something(void *userdata) {
// running with the main thread
}
// running in another thread
void *data; // "data" is a pointer to your user data
Fl::awake(do_something, data); // call something in main thread
Showing posts with label multithreading. Show all posts
Showing posts with label multithreading. Show all posts
Thursday, May 30, 2013
Multithreading in FLTK
The very smart way:
http://www.fltk.org/doc-1.3/advanced.html
Monday, March 18, 2013
Wednesday, October 3, 2012
Lock-free queue benchmark
My Lock and lock-free queue benchmark in Java:
https://github.com/exhu/miscalg/tree/master/lockfreej
Possibly contains ABA problem, but did not show itself while tests -)
Monday, August 27, 2012
Lock-free, wait-free, hazard pointers
Articles on the topic:
http://www.drdobbs.com/lock-free-data-structures-with-hazard-po/184401890
http://www.research.ibm.com/people/m/michael/ieeetpds-2004.pdf
http://www.ibm.com/developerworks/java/library/j-jtp10264/
Subscribe to:
Posts (Atom)