Implement basic thread operations in universal backend (including ##thread-save! and ##thread-restore!)