mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 11:34:16 +00:00
strtok_ts: Thread-safe strtok that work on POSIX or Windows
This commit is contained in:
parent
68111323b3
commit
7418f5e211
11
compat.h
11
compat.h
@ -9,6 +9,10 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
// NOTE: Windows strtok uses a thread-local static buffer, so this is safe
|
||||||
|
#define SETUP_STRTOK_TS /*nothing needed*/
|
||||||
|
#define strtok_ts strtok
|
||||||
|
|
||||||
#include "miner.h" // for timersub
|
#include "miner.h" // for timersub
|
||||||
|
|
||||||
static inline int nanosleep(const struct timespec *req, struct timespec *rem)
|
static inline int nanosleep(const struct timespec *req, struct timespec *rem)
|
||||||
@ -72,8 +76,13 @@ typedef long suseconds_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PTH(thr) ((thr)->pth.p)
|
#define PTH(thr) ((thr)->pth.p)
|
||||||
#else
|
#else /* ! WIN32 */
|
||||||
|
|
||||||
#define PTH(thr) ((thr)->pth)
|
#define PTH(thr) ((thr)->pth)
|
||||||
|
|
||||||
|
#define SETUP_STRTOK_TS char*_strtok_ts_saveptr
|
||||||
|
#define strtok_ts(str, delim) strtok_r(str, delim, &_strtok_ts_saveptr)
|
||||||
|
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
#endif /* __COMPAT_H__ */
|
#endif /* __COMPAT_H__ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user