34 friend class os; |
34 friend class os; |
35 |
35 |
36 private: |
36 private: |
37 |
37 |
38 // Support for "new" libthread APIs for getting & setting thread context (2.8) |
38 // Support for "new" libthread APIs for getting & setting thread context (2.8) |
39 #define TRS_VALID 0 |
39 #define TRS_VALID 0 |
40 #define TRS_NONVOLATILE 1 |
40 #define TRS_NONVOLATILE 1 |
41 #define TRS_LWPID 2 |
41 #define TRS_LWPID 2 |
42 #define TRS_INVALID 3 |
42 #define TRS_INVALID 3 |
43 |
43 |
44 // initialized to libthread or lwp synchronization primitives depending on UseLWPSychronization |
44 // initialized to libthread or lwp synchronization primitives depending on UseLWPSychronization |
45 static int_fnP_mutex_tP _mutex_lock; |
45 static int_fnP_mutex_tP _mutex_lock; |
46 static int_fnP_mutex_tP _mutex_trylock; |
46 static int_fnP_mutex_tP _mutex_trylock; |
47 static int_fnP_mutex_tP _mutex_unlock; |
47 static int_fnP_mutex_tP _mutex_unlock; |
59 |
59 |
60 typedef uintptr_t lgrp_cookie_t; |
60 typedef uintptr_t lgrp_cookie_t; |
61 typedef id_t lgrp_id_t; |
61 typedef id_t lgrp_id_t; |
62 typedef int lgrp_rsrc_t; |
62 typedef int lgrp_rsrc_t; |
63 typedef enum lgrp_view { |
63 typedef enum lgrp_view { |
64 LGRP_VIEW_CALLER, /* what's available to the caller */ |
64 LGRP_VIEW_CALLER, // what's available to the caller |
65 LGRP_VIEW_OS /* what's available to operating system */ |
65 LGRP_VIEW_OS // what's available to operating system |
66 } lgrp_view_t; |
66 } lgrp_view_t; |
67 |
67 |
68 typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n); |
68 typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n); |
69 |
69 |
70 typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id); |
70 typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id); |
214 static void set_mutex_unlock(int_fnP_mutex_tP func) { _mutex_unlock = func; } |
214 static void set_mutex_unlock(int_fnP_mutex_tP func) { _mutex_unlock = func; } |
215 static void set_mutex_init(int_fnP_mutex_tP_i_vP func) { _mutex_init = func; } |
215 static void set_mutex_init(int_fnP_mutex_tP_i_vP func) { _mutex_init = func; } |
216 static void set_mutex_destroy(int_fnP_mutex_tP func) { _mutex_destroy = func; } |
216 static void set_mutex_destroy(int_fnP_mutex_tP func) { _mutex_destroy = func; } |
217 static void set_mutex_scope(int scope) { _mutex_scope = scope; } |
217 static void set_mutex_scope(int scope) { _mutex_scope = scope; } |
218 |
218 |
219 static int cond_timedwait(cond_t *cv, mutex_t *mx, timestruc_t *abst) |
219 static int cond_timedwait(cond_t *cv, mutex_t *mx, timestruc_t *abst) { return _cond_timedwait(cv, mx, abst); } |
220 { return _cond_timedwait(cv, mx, abst); } |
|
221 static int cond_wait(cond_t *cv, mutex_t *mx) { return _cond_wait(cv, mx); } |
220 static int cond_wait(cond_t *cv, mutex_t *mx) { return _cond_wait(cv, mx); } |
222 static int cond_signal(cond_t *cv) { return _cond_signal(cv); } |
221 static int cond_signal(cond_t *cv) { return _cond_signal(cv); } |
223 static int cond_broadcast(cond_t *cv) { return _cond_broadcast(cv); } |
222 static int cond_broadcast(cond_t *cv) { return _cond_broadcast(cv); } |
224 static int cond_init(cond_t *cv) { return _cond_init(cv, os::Solaris::cond_scope(), NULL); } |
223 static int cond_init(cond_t *cv) { return _cond_init(cv, os::Solaris::cond_scope(), NULL); } |
225 static int cond_destroy(cond_t *cv) { return _cond_destroy(cv); } |
224 static int cond_destroy(cond_t *cv) { return _cond_destroy(cv); } |
226 static int cond_scope() { return _cond_scope; } |
225 static int cond_scope() { return _cond_scope; } |
227 |
226 |
228 static void set_cond_timedwait(int_fnP_cond_tP_mutex_tP_timestruc_tP func) |
227 static void set_cond_timedwait(int_fnP_cond_tP_mutex_tP_timestruc_tP func) { _cond_timedwait = func; } |
229 { _cond_timedwait = func; } |
|
230 static void set_cond_wait(int_fnP_cond_tP_mutex_tP func) { _cond_wait = func; } |
228 static void set_cond_wait(int_fnP_cond_tP_mutex_tP func) { _cond_wait = func; } |
231 static void set_cond_signal(int_fnP_cond_tP func) { _cond_signal = func; } |
229 static void set_cond_signal(int_fnP_cond_tP func) { _cond_signal = func; } |
232 static void set_cond_broadcast(int_fnP_cond_tP func) { _cond_broadcast = func; } |
230 static void set_cond_broadcast(int_fnP_cond_tP func) { _cond_broadcast = func; } |
233 static void set_cond_init(int_fnP_cond_tP_i_vP func) { _cond_init = func; } |
231 static void set_cond_init(int_fnP_cond_tP_i_vP func) { _cond_init = func; } |
234 static void set_cond_destroy(int_fnP_cond_tP func) { _cond_destroy = func; } |
232 static void set_cond_destroy(int_fnP_cond_tP func) { _cond_destroy = func; } |
245 static void set_lgrp_cookie(lgrp_cookie_t cookie) { _lgrp_cookie = cookie; } |
243 static void set_lgrp_cookie(lgrp_cookie_t cookie) { _lgrp_cookie = cookie; } |
246 |
244 |
247 static id_t lgrp_home(idtype_t type, id_t id) { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; } |
245 static id_t lgrp_home(idtype_t type, id_t id) { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; } |
248 static lgrp_cookie_t lgrp_init(lgrp_view_t view) { return _lgrp_init != NULL ? _lgrp_init(view) : 0; } |
246 static lgrp_cookie_t lgrp_init(lgrp_view_t view) { return _lgrp_init != NULL ? _lgrp_init(view) : 0; } |
249 static int lgrp_fini(lgrp_cookie_t cookie) { return _lgrp_fini != NULL ? _lgrp_fini(cookie) : -1; } |
247 static int lgrp_fini(lgrp_cookie_t cookie) { return _lgrp_fini != NULL ? _lgrp_fini(cookie) : -1; } |
250 static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; }; |
248 static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; } |
251 static int lgrp_children(lgrp_cookie_t cookie, lgrp_id_t parent, |
249 static int lgrp_children(lgrp_cookie_t cookie, lgrp_id_t parent, |
252 lgrp_id_t *lgrp_array, uint_t lgrp_array_size) { |
250 lgrp_id_t *lgrp_array, uint_t lgrp_array_size) { |
253 return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1; |
251 return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1; |
254 } |
252 } |
255 static int lgrp_resources(lgrp_cookie_t cookie, lgrp_id_t lgrp, |
253 static int lgrp_resources(lgrp_cookie_t cookie, lgrp_id_t lgrp, |