Generic Lightweight Thread (GLT) Library  2.5
A common API for Lightweight Thread solutions
 All Functions Variables Groups Pages
glt_doc.h
1 /* See COPYRIGHT in top-level directory. */
2 /*
3  * Function headers file.
4  */
5 
6 
7 #ifndef GLT_H
8 #define GLT_H
9 
55 
60 
65 
70 
75 
80 
85 
90 
95 
100 
105 
110 
115 
120 
125 
133 void glt_start(void);
134 
142 void glt_end(void);
143 
153 void glt_init(int argc, char * argv[]);
154 
162 void glt_finalize();
163 
173 GLT_ult * glt_ult_malloc(int number_of_ult);
174 
184 GLT_tasklet * glt_tasklet_malloc(int number_of_tasklets);
185 
195 void glt_ult_create(void(*thread_func)(void *), void *arg, GLT_ult *new_ult);
196 
207 void glt_ult_create_to(void(*thread_func)(void *), void *arg, GLT_ult *new_ult, int dest);
208 
218 void glt_tasklet_create(void(*thread_func)(void *), void *arg, GLT_tasklet *new_ult);
219 
230 void glt_tasklet_create_to(void(*thread_func)(void *), void *arg, GLT_tasklet *new_ult, int dest);
231 
239 void glt_yield();
240 
249 void glt_yield_to(GLT_ult ult);
250 
258 void glt_ult_join(GLT_ult *ult);
259 
267 void glt_tasklet_join(GLT_tasklet *tasklet);
268 
277 void glt_ult_get_id(GLT_ult_id * id, GLT_ult ult);
278 
287 
297 
305 void glt_ult_self(GLT_ult *ult);
306 
314 void glt_tasklet_self(GLT_tasklet *tasklet);
315 
323 void glt_ult_cancel(GLT_ult ult);
324 
332 void glt_tasklet_cancel(GLT_tasklet tasklet);
333 
340 void glt_ult_exit();
341 
348 void glt_mutex_create(GLT_mutex * mutex);
349 
356 void glt_mutex_lock(GLT_mutex mutex);
357 
364 void glt_mutex_unlock(GLT_mutex mutex);
365 
372 void glt_mutex_free(GLT_mutex * mutex);
373 
382 void glt_mutex_trylock(GLT_bool * locked, GLT_mutex mutex);
383 
391 void glt_barrier_create(int num_waiters, GLT_barrier *barrier);
392 
399 void glt_barrier_free(GLT_barrier *barrier);
400 
408 void glt_barrier_wait(GLT_barrier *barrier);
409 
416 void glt_cond_create(GLT_cond *cond);
417 
424 void glt_cond_free(GLT_cond *cond);
425 
432 void glt_cond_signal(GLT_cond cond);
433 
441 void glt_cond_wait(GLT_cond cond, GLT_mutex mutex);
442 
449 void glt_cond_broadcast(GLT_cond cond);
450 
457 double glt_get_wtime();
458 
465 void glt_timer_create(GLT_timer * timer);
466 
473 void glt_timer_free(GLT_timer * timer);
474 
481 void glt_timer_start(GLT_timer timer);
482 
489 void glt_timer_stop(GLT_timer timer);
490 
498 void glt_timer_get_secs(GLT_timer timer, double *secs);
499 
506 int glt_get_thread_num();
507 
514 int glt_get_num_threads();
515 
523 
534 void glt_scheduler_create(GLT_sched_def *def, int num_threads,
535  int *threads_id, GLT_sched_config config, GLT_sched *newsched);
536 
549  int num_threads, int *threads_id, GLT_sched_config config,
550  GLT_sched *newsched);
551 
559 void glt_scheduler_free(GLT_sched *sched);
560 
567 void glt_scheduler_finish(GLT_sched sched);
568 
575 void glt_scheduler_exit(GLT_sched sched);
576 
584 void glt_scheduler_has_to_stop(GLT_sched sched, GLT_bool *stop);
585 
593 void glt_scheduler_set_data(GLT_sched sched, void *data);
594 
602 void glt_scheduler_get_data(GLT_sched sched, void **data);
603 
611 void glt_scheduler_get_size(GLT_sched sched, size_t *size);
612 
620 void glt_scheduler_get_total_size(GLT_sched sched, size_t *size);
621 
629 void glt_key_create(void(*destructor)(void *value), GLT_key *newkey);
630 
637 void glt_key_free(GLT_key *key);
638 
646 void glt_key_set(GLT_key key, void *value);
647 
655 void glt_key_get(GLT_key key, void **value);
656 
657 int glt_can_event_functions();
658 int glt_can_future_functions();
659 int glt_can_promise_functions();
660 //int glt_can_tls_functions();
661 int glt_can_extended_mutex();
662 int glt_can_manage_pools();
663 //int glt_can_manage_scheduler();
664 int glt_can_self();
665 int glt_can_manage_threads();
666 int can_extended_tasklets();
667 int can_extended_ults();
668 
669 //QUERY functions for QTHREADS
670 //Always return 0;
671 int glt_can_extended_basic();
672 int glt_can_atomic_functions();
673 int glt_can_feb_functions();
674 int glt_can_sinc_functions();
675 int glt_can_loop_functions();
676 int glt_can_util_functions();
677 int glt_can_data_structures_functions();
678 int glt_can_syscall_functions();
679 int glt_can_extended_runtime();
680 
681 //QUERY functions for MAssiveThreads
682 //Always return 0;
683 int glt_can_wsapi_functions();
684 int glt_can_prof_functions();
685 int glt_can_log_functions();
686 int can_felock_functions();
687 int can_extended_workunits();
688 
689 #ifndef CORE
690 void glt_get_error_str(int errno, char *str, size_t *len);
691 void glt_event_add_callbac(GLT_event_kind event, GLT_event_cb_fn ask_cb,
692  void *ask_user_arg, GLT_event_cb_fn act_cb, void *act_user_arg,
693  int *cb_id);
694 void glt_event_del_callback(GLT_event_kind event, int cb_id);
695 
696 void glt_future_create(int nbytes, GLT_future *newfuture);
697 void glt_future_free(GLT_future *future);
698 void glt_future_wait(GLT_future future, void **value);
699 void glt_future_set(GLT_future future, void *value, int nbytes);
700 
701 void glt_promise_create(uint32_t compartments, void(*cb_func)(void **arg), GLT_promise *newpromise);
702 void glt_promise_free(GLT_promise *promise);
703 void glt_promise_wait(GLT_promise promise);
704 void glt_promise_test(GLT_promise promise, GLT_bool *flag);
705 void glt_promise_set(GLT_promise promise, void * value);
706 
707 void glt_mutex_lock_low(GLT_mutex mutex);
708 void glt_mutex_spinlock(GLT_mutex mutex);
709 void glt_mutex_unlock_se(GLT_mutex mutex);
710 void glt_mutex_equal(GLT_mutex mutex1, GLT_mutex mutex2, GLT_bool *result);
711 
712 void glt_pool_create(GLT_pool_def *def, GLT_pool_config config,
713  GLT_pool *newpool);
714 void glt_pool_create_basic(GLT_pool_kind kind,
715  GLT_pool_access access, GLT_bool automatic, GLT_pool *newpool);
716 void glt_pool_free(GLT_pool *pool);
717 void glt_pool_get_access(GLT_pool pool, GLT_pool_access *access);
718 void glt_pool_get_total_size(GLT_pool pool, size_t *size);
719 void glt_pool_get_size(GLT_pool pool, size_t *size);
720 void glt_pool_pop(GLT_pool pool, GLT_unit *p_unit);
721 void glt_pool_push(GLT_pool pool, GLT_unit p_unit);
722 void glt_pool_remove(GLT_pool pool, GLT_unit p_unit);
723 void glt_pool_set_data(GLT_pool pool, void *data);
724 void glt_pool_get_data(GLT_pool pool, void **data);
725 void glt_pool_add_sched(GLT_pool pool, GLT_sched sched);
726 void glt_pool_get_id(GLT_pool pool, int *id);
727 void glt_pool_create_scheduler(GLT_sched_def *def, int num_pools,
728  GLT_pool *pools, GLT_sched_config config, GLT_sched *newsched);
729 void glt_pool_create_basic_scheduler(GLT_sched_predef predef,
730  int num_pools, GLT_pool *pools, GLT_sched_config config,
731  GLT_sched *newsched);
732 void glt_pool_scheduler_get_pools(GLT_sched sched, int max_pools,
733  int idx, GLT_pool *pools);
734 void glt_pool_scheduler_get_num_pools(GLT_sched sched, int *num_pools);
735 
736 void glt_self_get_type(GLT_unit_type *type);
737 void glt_self_is_primary(GLT_bool *flag);
738 void glt_self_on_primary_xstream(GLT_bool *flag);
739 void glt_self_get_last_pool_id(int *pool_id);
740 void glt_self_suspend(void);
741 void glt_self_get_arg(void **arg);
742 
743 void glt_thread_create(GLT_sched sched, GLT_thread *newthread);
744 void glt_thread_create_basic(GLT_sched_predef predef, int num_pools,
745  GLT_pool *pools, GLT_sched_config config, GLT_thread *newthread);
746 void glt_thread_start(GLT_thread thread);
747 void glt_thread_free(GLT_thread *thread);
748 void glt_thread_join(GLT_thread thread);
749 void glt_thread_exit();
750 void glt_thread_cancel(GLT_thread *thread);
751 
752 void glt_thread_self(GLT_thread *thread);
753 void glt_thread_self_rank(int *rank);
754 void glt_thread_get_rank(GLT_thread thread, int *rank);
755 void glt_thread_set_main_sched(GLT_thread thread, GLT_sched sched);
756 void glt_thread_set_main_sched_basic(GLT_thread thread,
757  GLT_sched_predef predef, int num_pools, GLT_pool *pools);
758 void glt_thread_get_main_sched(GLT_thread thread, GLT_sched *sched);
759 void glt_thread_get_main_pools(GLT_thread thread, int max_pools,
760  GLT_pool *pools);
761 void glt_thread_get_state(GLT_thread thread, GLT_thread_state *state);
762 void glt_thread_equal(GLT_thread thread1, GLT_thread thread2, GLT_bool *result);
763 void glt_thread_get_num(int *num_xstreams);
764 void glt_thread_is_primary(GLT_thread thread, GLT_bool *flag);
765 void glt_thread_run_unit(GLT_unit unit, GLT_pool pool);
766 void glt_thread_check_events(GLT_sched sched);
767 
768 void glt_tasklet_get_thread(GLT_tasklet tasklet, GLT_thread *thread);
769 void glt_tasklet_get_state(GLT_tasklet tasklet, GLT_tasklet_state *state);
770 void glt_tasklet_get_last_pool(GLT_tasklet tasklet, GLT_pool *pool);
771 void glt_tasklet_get_last_pool_id(GLT_tasklet tasklet, int *id);
772 void glt_tasklet_set_migratable(GLT_tasklet tasklet, GLT_bool flag);
773 void glt_tasklet_is_migratable(GLT_tasklet tasklet, GLT_bool *flag);
774 void glt_tasklet_equal(GLT_tasklet tasklet1, GLT_tasklet tasklet2, GLT_bool *result);
775 void glt_tasklet_retain(GLT_tasklet tasklet);
776 void glt_tasklet_release(GLT_tasklet tasklet);
777 void glt_tasklet_get_arg(GLT_tasklet tasklet, void **arg);
778 void glt_tasklet_create_to_pool(GLT_pool pool, void(*thread_func)(void *), void *arg, GLT_tasklet *new_ult);
779 
780 void glt_ult_create_to_pool(GLT_pool pool, void(*thread_func)(void *), void *arg, GLT_ult *new_ult);
781 void glt_ult_get_state(GLT_ult ult, GLT_ult_state *state);
782 void glt_ult_get_last_pool(GLT_ult ult, GLT_pool *pool);
783 void glt_ult_get_last_pool_id(GLT_ult ult, int *id);
784 void glt_ult_resume(GLT_ult ult);
785 void glt_ult_migrate_to_thread(GLT_ult ult, GLT_thread thread);
786 void glt_ult_migrate_to_scheduler(GLT_ult ult, GLT_sched sched);
787 void glt_ult_migrate_to_pool(GLT_ult ult, GLT_pool pool);
788 void glt_ult_migrate(GLT_ult ult);
789 void glt_ult_set_callback(GLT_ult ult, void(*cb_func)(GLT_ult ult, void *cb_arg), void *cb_arg);
790 void glt_ult_set_migratable(GLT_ult ult, GLT_bool flag);
791 void glt_ult_is_migratable(GLT_ult ult, GLT_bool *flag);
792 void glt_ult_is_primary(GLT_ult ult, GLT_bool *flag);
793 void glt_ult_equal(GLT_ult ult1, GLT_ult ult2, GLT_bool * result);
794 void glt_ult_retain(GLT_ult ult);
795 void glt_ult_release(GLT_ult ult);
796 void glt_ult_get_stacksize(GLT_ult ult, size_t *stacksize);
797 void glt_ult_get_arg(GLT_ult ult, void **arg);
798 void glt_ult_attr_create(GLT_ult_attr *newattr);
799 void glt_ult_attr_free(GLT_ult_attr *attr);
800 void glt_ult_attr_set_stacksize(GLT_ult_attr attr, size_t stacksize);
801 void glt_ult_attr_get_stacksize(GLT_ult_attr attr, size_t *stacksize);
802 void glt_ult_attr_set_callback(GLT_ult_attr attr, void(*cb_func)(GLT_ult ult, void *cb_arg), void *cb_arg);
803 void glt_ult_attr_set_migratable(GLT_ult_attr attr, GLT_bool flag);
804 
805 //HEADERS for QTHREADS extended functions
806 void glt_ult_create_syncvar(void(*thread_func)(void *), void * arg,
807  GLT_syncvar *syncvar);
808 void glt_ult_create_syncvar_to(void(*thread_func)(void *), void * arg,
809  GLT_syncvar *syncvar, int dest, int npreconds, ...);
810 void glt_ult_get_thread(GLT_thread *thread, int *worker);
811 void glt_ult_get_thread_unique(GLT_thread *thread, int *worker);
812 void glt_ult_get_tasklocal(void * pointer, unsigned int size);
813 void glt_ult_size_tasklocal(unsigned int *size);
814 void glt_ult_get_stack_left(size_t *size);
815 void glt_ult_retloc(GLT_ult * ult);
816 void glt_atomic_incr(GLT_aligned * operand, int incr);
817 void glt_atomic_fincr(float * operand, float incr);
818 void glt_atomic_dincr(double * operand, double incr);
819 void glt_atomic_cas(volatile GLT_aligned * addr, GLT_aligned oldval,
820  GLT_aligned newval);
821 void glt_atomic_cas_ptr(void * volatile * addr, void * oldval,
822  void * newval);
823 void glt_feb_empty(const GLT_memory_state *dest);
824 void glt_feb_fill(const GLT_memory_state *dest);
825 void glt_feb_status(const GLT_memory_state *addr, int *status);
826 void glt_feb_readFE(GLT_memory_state *dst, const GLT_memory_state *src);
827 void glt_feb_readFF(GLT_memory_state *dst, const GLT_memory_state *src);
828 void glt_feb_writeEF(GLT_memory_state * restrict dst, const GLT_memory_state * restrict src);
829 void glt_feb_writeEF_const(GLT_memory_state * dst, GLT_memory_state src);
830 void glt_feb_writeF(GLT_memory_state * restrict dst, const GLT_memory_state * restrict src);
831 void glt_feb_writeF_const(GLT_memory_state * dst, GLT_memory_state src);
832 void glt_syncvar_empty(GLT_syncvar *dest);
833 void glt_syncvar_fill(GLT_syncvar *dest);
834 void glt_syncvar_status(GLT_syncvar *addr, int *status);
835 void glt_syncvar_readFE(uint64_t * restrict dst, GLT_syncvar * restrict src);
836 void glt_syncvar_readFF(uint64_t * restrict dst, GLT_syncvar * restrict src);
837 void glt_syncvar_writeEF(GLT_syncvar * restrict dst, const uint64_t * restrict src);
838 void glt_syncvar_writeEF_const(GLT_syncvar * dst, uint64_t src);
839 void glt_syncvar_writeF(GLT_syncvar * restrict dst, const uint64_t * restrict src);
840 void glt_syncvar_writeF_const(GLT_syncvar * dst, uint64_t src);
841 void glt_sinc_create(GLT_sinc *sinc, size_t sizeof_value,
842  const void * initial_value, GLT_sinc_op op, size_t expected);
843 void glt_sinc_init(GLT_sinc *restrict sinc, size_t sizeof_value,
844  const void * initial_value, GLT_sinc_op op, size_t expected);
845 void glt_sinc_destroy(GLT_sinc *sinc);
846 void glt_sinc_fini(GLT_sinc * sinc);
847 void glt_sinc_reset(GLT_sinc * sinc, size_t expect);
848 void glt_sinc_submit(GLT_sinc * restrict sinc, const void * restrict value);
849 void glt_sinc_wait(GLT_sinc * restrict sinc, void * restrict target);
850 void glt_loop(const size_t start, const size_t end,
851  const GLT_loop_f func, void * arg);
852 
853 
854 void glt_loop_balance(const size_t start, const size_t end,
855  const GLT_loop_f func, void * arg);
856 
857 void glt_loopaccum_balance(const size_t start, const size_t end,
858  size_t size, void *out, const GLT_loopr_f func, void * arg, GLT_accum_f acc);
859 
860 void glt_loop_queue_create(GLT_loop_queue * loop, GLT_loop_queue_kind kind,
861  const size_t start, const size_t end,
862  const size_t stride, const GLT_loop_f func, void * arg);
863 void glt_loop_queue_set_chunk(GLT_loop_queue * loop, size_t chunk);
864 void glt_loop_queue_run(GLT_loop_queue * loop);
865 void glt_loop_queue_run_there(GLT_loop_queue * loop, GLT_thread id);
866 void glt_loop_queue_add_thread(GLT_loop_queue * loop, GLT_thread id);
867 void glt_util_double_max(double * res, double * array,
868  size_t lenght, int checkfeb);
869 void glt_util_uint_max(unsigned int * res,
870  const long unsigned int * array, size_t lenght, int checkfeb);
871 void glt_util_int_max(int * res, const long int * array,
872  size_t lenght, int checkfeb);
873 void glt_util_double_min(double * res, double * array,
874  size_t lenght, int checkfeb);
875 void glt_util_uint_min(unsigned int * res,
876  const long unsigned int * array, size_t lenght, int checkfeb);
877 void glt_util_int_min(int * res, const long int * array,
878  size_t lenght, int checkfeb);
879 void glt_util_double_mult(double * res, double * array,
880  size_t lenght, int checkfeb);
881 void glt_util_uint_mult(unsigned int * res,
882  const long unsigned int * array, size_t lenght, int checkfeb);
883 void glt_util_int_mult(int * res, const long int * array,
884  size_t lenght, int checkfeb);
885 void glt_util_double_sum(double * res, double * array,
886  size_t lenght, int checkfeb);
887 void glt_util_uint_sum(unsigned int * res,
888  const long unsigned int * array, size_t lenght,
889  int checkfeb);
890 void glt_util_int_sum(int * res, const long int * array, size_t lenght,
891  int checkfeb);
892 void glt_util_qsort(double * array, size_t lenght);
893 void glt_util_mergesort(double * array, size_t lenght);
894 void glt_ds_pool_create(GLT_ds_pool *pool, const size_t item_size);
895 void glt_ds_pool_create_aligned(GLT_ds_pool *pool,
896  const size_t item_size, const size_t alignment);
897 void glt_ds_pool_destroy(GLT_ds_pool *pool);
898 void glt_ds_pool_alloc(GLT_ds_pool *pool);
899 void glt_ds_pool_free(GLT_ds_pool *restrict pool,
900  void * restrict mem);
901 void glt_ds_array_create(GLT_ds_array *array, const size_t count,
902  const size_t item_size);
903 void glt_ds_array_create_tight(GLT_ds_array *array,
904  const size_t count, const size_t item_size);
905 void glt_ds_array_create_configured(GLT_ds_array *array,
906  const size_t count, const size_t item_size,
907  const GLT_ds_array_distribution d, const char thight, const int seg_pages);
908 void glt_ds_array_destroy(GLT_ds_array *array);
909 void glt_ds_array_elem(void * elem, const GLT_ds_array *array,
910  const size_t index);
911 void glt_ds_array_elem_nomigrate(void * elem, const GLT_ds_array *array,
912  const size_t index);
913 void glt_ds_array_elem_migrate(void * elem, const GLT_ds_array *array,
914  const size_t index);
915 void glt_ds_array_thread_of(GLT_thread * id, const GLT_ds_array *array,
916  const size_t index);
917 void glt_ds_array_set_thread_of(GLT_ds_array *array,
918  const size_t index, GLT_thread id);
919 void glt_ds_array_iter(GLT_ds_array *array,
920  const size_t start, const size_t stop, void(*thread_func)(void *));
921 void glt_ds_array_iter_loop(GLT_ds_array *array,
922  const size_t start, const size_t stop, GLT_ds_loop_f thread_func, void * arg);
923 void glt_ds_array_iter_nb(GLT_ds_array *array,
924  const size_t start, const size_t stop, GLT_ds_loop_f thread_func,
925  void * args, aligned_t *arg);
926 void glt_ds_array_iter_constloop(GLT_ds_array *array,
927  const size_t start, const size_t stop, GLT_ds_cloop_f thread_func,
928  void * args);
929 void glt_ds_array_iter_loopaccum(GLT_ds_array *array,
930  const size_t start, const size_t stop, GLT_ds_loopr_f thread_func,
931  void * args, void * ret, const size_t resize, GLT_accum_f acc);
932 void glt_ds_lfqueue_create(GLT_ds_lfqueue * lfqueue);
933 void glt_ds_lfqueue_destroy(GLT_ds_lfqueue * lfqueue);
934 void glt_ds_lfqueue_enqueue(GLT_ds_lfqueue * lfqueue, void * elem);
935 void glt_ds_lfqueue_dequeue(void * elem, GLT_ds_lfqueue * lfqueue);
936 void glt_ds_lfqueue_empty(GLT_bool * empty, GLT_ds_lfqueue * lfqueue);
937 void glt_ds_dqueue_create(GLT_ds_dqueue * dqueue);
938 void glt_ds_dqueue_destroy(GLT_ds_dqueue * dqueue);
939 void glt_ds_dqueue_enqueue(GLT_ds_dqueue * dqueue, void * elem);
940 void glt_ds_dqueue_enqueue_there(GLT_ds_dqueue * dqueue,
941  void * elem, GLT_thread id);
942 void glt_ds_dqueue_dequeue(void * elem, GLT_ds_dqueue * dqueue);
943 void glt_ds_dqueue_empty(GLT_bool * empty, GLT_ds_dqueue * dqueue);
944 void glt_ds_dictionary_create(GLT_ds_dictionary * dictionary,
945  GLT_ds_dictionary_key_equals eq,
946  GLT_ds_dictionary_hash hash, GLT_ds_dictionary_cleanup cleanup);
947 void glt_ds_dictionary_destroy(GLT_ds_dictionary * dictionary);
948 void glt_ds_dictionary_put(void * next, GLT_ds_dictionary * dictionary,
949  void * key, void *value);
950 void glt_ds_dictionary_put_if_absent(void * next, GLT_ds_dictionary * dictionary,
951  void * key, void *value);
952 void glt_ds_dictionary_get(void * value, GLT_ds_dictionary * dictionary,
953  void * key);
954 void glt_ds_dictionary_delete(void * value, GLT_ds_dictionary * dictionary,
955  void * key);
956 void glt_ds_dictionary_end(GLT_ds_dictionary_it *it,
957  GLT_ds_dictionary * dictionary);
958 void glt_ds_dictionary_it_create(GLT_ds_dictionary_it *it,
959  GLT_ds_dictionary * dictionary);
960 void glt_ds_dictionary_it_destroy(GLT_ds_dictionary_it *it);
961 void glt_ds_dictionary_it_next(void * entry, GLT_ds_dictionary_it *it);
962 void glt_ds_dictionary_it_get(void * entry, GLT_ds_dictionary_it *it);
963 void glt_ds_dictionary_it_equals(GLT_bool * eq,
964  GLT_ds_dictionary_it *it1, GLT_ds_dictionary_it *it2);
965 void glt_ds_dictionary_it_copy(GLT_ds_dictionary_it *output,
966  GLT_ds_dictionary_it *input);
967 void glt_syscall_begin_blocking();
968 void glt_syscall_end_blocking();
969 int glt_syscall_accept(int socket,
970  struct sockaddr *restrict address, socklen_t *restrict address_len);
971 int glt_syscall_connect(int socket,
972  struct sockaddr *restrict address, socklen_t address_len);
973 int glt_syscall_poll(struct pollfd fds[], nfds_t nfds, int timeout);
974 size_t glt_syscall_pread(int filedes, void *buf, size_t nbyte,
975  off_t offset);
976 size_t glt_syscall_read(int filedes, void *buf, size_t nbyte);
977 size_t glt_syscall_pwrite(int filedes, void *buf, size_t nbyte,
978  off_t offset);
979 size_t glt_syscall_write(int filedes, void *buf, size_t nbyte);
980 int glt_syscall_select(int nfds, fd_set *restrict readfds,
981  fd_set *restrict writefds, fd_set *restrict errorfds,
982  struct timeval *restrict timeout);
983 int glt_syscall_system(const char * command);
984 int glt_syscall_wait4(pid_t pid, int *stat_loc, int options,
985  struct rusage *rusage);
986 void glt_subthread_get_num(GLT_subthread *num);
987 void glt_cacheline(int *cl);
988 void glt_sorted_threads(const GLT_thread * list);
989 void glt_sorted_threads_remote(const GLT_thread * list, const GLT_thread src);
990 void glt_debuglevel(size_t *level, const enum introspective_state type);
991 void glt_readstate(size_t *value, const enum introspective_state type);
992 void glt_thread_distance(int * dist, const GLT_thread src, const GLT_thread dst);
993 void glt_thread_enable(GLT_thread id);
994 void glt_thread_disable(GLT_bool *res, GLT_thread id);
995 void glt_subthread_enable(GLT_subthread id);
996 void glt_subthread_disable(GLT_bool *res, GLT_subthread id);
997 void glt_thread_ok(GLT_bool *res);
998 
999 //HEADERS for MASSIVETHREADS extended functions
1000 void glt_wu_create_ex(GLT_ult * ult, GLT_workunit_f func, void * arg,
1001  GLT_workunit_o opt);
1002 
1003 void glt_yield2();
1004 void glt_wu_detach(GLT_ult ult);
1005 void glt_wu_set_cancel_state(int state, int *oldstate);
1006 void glt_wu_set_cancel_type(int type, int *oldtype);
1007 void glt_wu_test_cancel();
1008 void glt_wu_set_def_stack_size(size_t newsize);
1009 
1010 void glt_felock_create(GLT_felock * felock);
1011 void glt_felock_free(GLT_felock felock);
1012 void glt_felock_lock(GLT_bool *lock, GLT_felock felock);
1013 void glt_felock_wait_lock(GLT_bool *lock, GLT_felock felock, int val);
1014 void glt_felock_unlock(GLT_bool *unlock, GLT_felock felock);
1015 void glt_felock_status(GLT_felock_status *status, GLT_felock felock);
1016 void glt_felock_set_unlock(GLT_felock felock, int val);
1017 
1018 void glt_key_create(void(*destructor)(void *value), GLT_key *newkey);
1019 void glt_key_free(GLT_key *key);
1020 void glt_key_set(GLT_key key, void *value);
1021 void glt_key_get(GLT_key key, void **value);
1022 
1023 void glt_log_start();
1024 void glt_log_pause();
1025 void glt_log_flush();
1026 void glt_log_reset();
1027 void glt_log_annotate_ult(GLT_ult ult, char *name);
1028 void glt_sched_prof_start();
1029 void glt_sched_prof_pause();
1030 
1031 void glt_wsapi_runqueue_peek(GLT_ult *ult, int victim, void *ptr, size_t *psize);
1032 void glt_wsapi_get_hint_size(size_t *size, GLT_ult ult);
1033 void glt_wsapi_get_hint_ptr(void *ptr, GLT_ult ult);
1034 void glt_wsapi_set_hint(GLT_ult ult, void **data, size_t *size);
1035 void glt_wsapi_rand(int * rand);
1036 void glt_wsapi_randrr(int *ret, int n);
1037 void glt_wsapi_runqueue_take(GLT_ult * ult, int victim, GLT_wsapi_decide_f decidefn, void *udata);
1038 void glt_wsapi_runqueue_pass(GLT_bool *pass, int target, GLT_ult ult);
1039 void glt_wsapi_runqueue_push(GLT_ult ult);
1040 void glt_wsapi_runqueue_pop(GLT_ult * ult);
1041 void glt_wsapi_set_stealfunc(GLT_wsapi_steal_f *out, GLT_wsapi_steal_f fn);
1042 
1043 #endif
1044 
1045 #endif /* glt_H */
1046 
void glt_key_create(void(*destructor)(void *value), GLT_key *newkey)
Creates a key.
void glt_cond_create(GLT_cond *cond)
Creates a condition.
void glt_mutex_unlock(GLT_mutex mutex)
Unlocks a mutex.
void glt_ult_join(GLT_ult *ult)
Joins an specific ULT.
void glt_mutex_lock(GLT_mutex mutex)
Locks a mutex.
void glt_ult_self(GLT_ult *ult)
Obtains the current ULT handle.
GLT_ult
The user level thread abstraction.
Definition: glt_doc.h:54
void glt_key_get(GLT_key key, void **value)
Gets value from a key.
GLT_ult * glt_ult_malloc(int number_of_ult)
ULT allocation.
GLT_sched
The scheduler abstraction.
Definition: glt_doc.h:109
GLT_thread
The thread abstraction.
Definition: glt_doc.h:64
void glt_scheduler_create(GLT_sched_def *def, int num_threads, int *threads_id, GLT_sched_config config, GLT_sched *newsched)
Creates a new scheduler.
void glt_ult_create_to(void(*thread_func)(void *), void *arg, GLT_ult *new_ult, int dest)
ULT creation in a given destination.
double glt_get_wtime()
Returns the current time.
void glt_mutex_create(GLT_mutex *mutex)
Creates a mutex.
void glt_scheduler_set_data(GLT_sched sched, void *data)
Sets new data to a scheduler.
void glt_scheduler_has_to_stop(GLT_sched sched, GLT_bool *stop)
Requires to a scheduler to stop.
void glt_barrier_create(int num_waiters, GLT_barrier *barrier)
Creates a barrier.
void glt_scheduler_exit(GLT_sched sched)
Stops a scheduler.
GLT_ult_id
The ult id abstraction.
Definition: glt_doc.h:99
void glt_scheduler_get_size(GLT_sched sched, size_t *size)
gets the current size from the scheduler.
int glt_get_thread_num()
Obtains the number of the current thread.
void glt_ult_create(void(*thread_func)(void *), void *arg, GLT_ult *new_ult)
ULT creation.
void glt_key_set(GLT_key key, void *value)
Sets new value to a key.
GLT_key
The key abstraction.
Definition: glt_doc.h:104
void glt_ult_cancel(GLT_ult ult)
Cancels an specific ULT.
GLT_barrier
The barrier abstraction.
Definition: glt_doc.h:74
void glt_end(void)
Ending point for the GLT dynamic library.
void glt_barrier_wait(GLT_barrier *barrier)
Waits into a barrier.
void glt_mutex_trylock(GLT_bool *locked, GLT_mutex mutex)
Tries to lock a mutex.
GLT_sched_config
The scheduler configuration abstraction.
Definition: glt_doc.h:114
void glt_cond_signal(GLT_cond cond)
Sends a signal for a condition.
void glt_init(int argc, char *argv[])
GLT initialization function.
void glt_ult_exit()
Exits the current ULT.
GLT_mutex
The mutex abstraction.
Definition: glt_doc.h:69
int glt_get_num_threads()
Returns the total number of threads.
GLT_tasklet * glt_tasklet_malloc(int number_of_tasklets)
ULT allocation.
GLT_bool
The boolean abstraction.
Definition: glt_doc.h:89
void glt_finalize()
GLT finalization function.
void glt_timer_stop(GLT_timer timer)
Stops a timer.
GLT_cond
The condition abstraction.
Definition: glt_doc.h:79
GLT_sched_predef
The scheduler predefinition abstraction.
Definition: glt_doc.h:124
void glt_tasklet_cancel(GLT_tasklet tasklet)
Cancels an specific Tasklet.
void glt_cond_wait(GLT_cond cond, GLT_mutex mutex)
A ULT waits in this point for a signal.
void glt_cond_broadcast(GLT_cond cond)
Broadcast a signal for a condition.
void glt_key_free(GLT_key *key)
Destroys a key.
GLT_thread_id
The thread id abstraction.
Definition: glt_doc.h:94
void glt_scheduler_finish(GLT_sched sched)
Finalizes a scheduler.
void glt_workunit_get_thread_id(GLT_thread_id *id)
Return the unique id of a thread.
void glt_timer_create(GLT_timer *timer)
Creates a timer.
void glt_yield_to(GLT_ult ult)
ULT yields to an specific ULT.
GLT_timer
The timer abstraction.
Definition: glt_doc.h:84
void glt_scheduler_get_data(GLT_sched sched, void **data)
gets data from a scheduler.
void glt_schededuler_create_basic(GLT_sched_predef predef, int num_threads, int *threads_id, GLT_sched_config config, GLT_sched *newsched)
Creates a new scheduler with predefined behaviour.
void glt_timer_get_secs(GLT_timer timer, double *secs)
Obtains the elapsed time.
void glt_timer_start(GLT_timer timer)
Inits a timer.
void glt_scheduler_config_free(GLT_sched_config *config)
Destroys the scheduler configuration.
void glt_cond_free(GLT_cond *cond)
Destroys a condition.
void glt_start(void)
Entry point for the GLT dynamic library.
GLT_tasklet
The tasklet abstraction.
Definition: glt_doc.h:59
void glt_scheduler_free(GLT_sched *sched)
Destroys a scheduler.
void glt_ult_migrate_self_to(GLT_thread_id id)
Migrates the current ULT to another thread ready queue.
void glt_tasklet_create(void(*thread_func)(void *), void *arg, GLT_tasklet *new_ult)
Tasklet creation.
void glt_timer_free(GLT_timer *timer)
Destroys a timer.
void glt_yield()
ULT yields to another ready ULT.
void glt_tasklet_join(GLT_tasklet *tasklet)
Joins an specific Tasklet.
void glt_tasklet_self(GLT_tasklet *tasklet)
Obtains the current Tasklet handle.
void glt_ult_get_id(GLT_ult_id *id, GLT_ult ult)
Return the unique id of a ULT.
void glt_barrier_free(GLT_barrier *barrier)
Destroys a barrier.
GLT_sched_def
The scheduler definition abstraction.
Definition: glt_doc.h:119
void glt_tasklet_create_to(void(*thread_func)(void *), void *arg, GLT_tasklet *new_ult, int dest)
Tasklet creation.
void glt_mutex_free(GLT_mutex *mutex)
Destroys a mutex.
void glt_scheduler_get_total_size(GLT_sched sched, size_t *size)
gets the total size from the scheduler.