- if(!sym->tls_index) {
- sym->tls_index=SymbolValue(FREE_TLS_INDEX,0);
- SetSymbolValue(FREE_TLS_INDEX,
- make_fixnum(fixnum_value(sym->tls_index)+1),0);
+ {
+ struct symbol *sym=(struct symbol *)native_pointer(symbol);
+ if(!sym->tls_index) {
+ lispobj *tls_index_lock=
+ &((struct symbol *)native_pointer(TLS_INDEX_LOCK))->value;
+ FSHOW_SIGNAL((stderr, "entering dynbind tls alloc\n"));
+ set_pseudo_atomic_atomic(thread);
+ get_spinlock(tls_index_lock,(long)th);
+ if(!sym->tls_index) {
+ sym->tls_index=SymbolValue(FREE_TLS_INDEX,0);
+ SetSymbolValue(FREE_TLS_INDEX, sym->tls_index+N_WORD_BYTES, 0);
+ if((sym->tls_index)>=(TLS_SIZE << WORD_SHIFT)) {
+ lose("Thread local storage exhausted.");
+ }
+ }
+ release_spinlock(tls_index_lock);
+ FSHOW_SIGNAL((stderr, "exiting dynbind tls alloc\n"));
+ clear_pseudo_atomic_atomic(thread);
+ if (get_pseudo_atomic_interrupted(thread))
+ do_pending_interrupt();
+ }