- 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;
+ clear_pseudo_atomic_interrupted(th);
+ set_pseudo_atomic_atomic(th);
+ get_spinlock(tls_index_lock,(long)th);
+ 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);
+ }
+ release_spinlock(tls_index_lock);
+ clear_pseudo_atomic_atomic(th);
+ if (get_pseudo_atomic_interrupted(th))
+ do_pending_interrupt();
+ }