set up thread pools (readers and writers) returns 1 if thread pools initialized, 0 otherwise
| 39 | // set up thread pools (readers and writers) |
| 40 | // returns 1 if thread pools initialized, 0 otherwise |
| 41 | int ThreadPools_CreatePools |
| 42 | ( |
| 43 | uint reader_count, |
| 44 | uint writer_count, |
| 45 | uint64_t max_pending_work |
| 46 | ) { |
| 47 | ASSERT(_readers_thpool == NULL); |
| 48 | ASSERT(_writers_thpool == NULL); |
| 49 | |
| 50 | _readers_thpool = thpool_init(reader_count, "reader"); |
| 51 | if(_readers_thpool == NULL) return 0; |
| 52 | |
| 53 | _writers_thpool = thpool_init(writer_count, "writer"); |
| 54 | if(_writers_thpool == NULL) return 0; |
| 55 | |
| 56 | ThreadPools_SetMaxPendingWork(max_pending_work); |
| 57 | |
| 58 | return 1; |
| 59 | } |
| 60 | |
| 61 | // return number of threads in both the readers and writers pools |
| 62 | uint ThreadPools_ThreadCount |