| 776 | } rotsq_thread_ctx_t; |
| 777 | |
| 778 | static void *rotsq_concurrent_first_encode(void *opaque) { |
| 779 | rotsq_thread_ctx_t *ctx = opaque; |
| 780 | float vec[CBM_RSQ_IN_DIM]; |
| 781 | for (int i = 0; i < CBM_RSQ_IN_DIM; i++) { |
| 782 | vec[i] = ctx->value + (float)i / (float)CBM_RSQ_IN_DIM; |
| 783 | } |
| 784 | atomic_fetch_add_explicit(ctx->ready, 1, memory_order_release); |
| 785 | while (atomic_load_explicit(ctx->start, memory_order_acquire) == 0) { |
| 786 | cbm_usleep(1000); |
| 787 | } |
| 788 | cbm_rsq_encode(vec, &ctx->code); |
| 789 | return NULL; |
| 790 | } |
| 791 | |
| 792 | /* The daemon can initialize semantic encoders from multiple request threads. |
| 793 | * Run this first so ThreadSanitizer observes the one-time initialization. */ |
nothing calls this directly
no test coverage detected