Cygwin: sched_setscheduler: allow changes of the priority
[newlib-cygwin.git] / winsup / cygwin / local_includes / tls_pbuf.h
blobf2cc3001c9303ccb3af6a425ee665a2cdb53aab4
1 /* tls_pbuf.h
3 This software is a copyrighted work licensed under the terms of the
4 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
5 details. */
7 #pragma once
9 class tmp_pathbuf
11 uint32_t c_buf_old;
12 uint32_t w_buf_old;
13 public:
14 tmp_pathbuf () __attribute__ ((always_inline))
15 : c_buf_old (_my_tls.locals.pathbufs.c_cnt),
16 w_buf_old (_my_tls.locals.pathbufs.w_cnt)
18 ~tmp_pathbuf () __attribute__ ((always_inline))
20 _my_tls.locals.pathbufs.c_cnt = c_buf_old;
21 _my_tls.locals.pathbufs.w_cnt = w_buf_old;
24 inline bool check_usage (uint32_t c_need, uint32_t w_need)
26 return c_need + c_buf_old < TP_NUM_C_BUFS
27 && w_need + w_buf_old < TP_NUM_W_BUFS;
29 char *c_get (); /* Create temporary TLS path buf of size NT_MAX_PATH. */
30 PWCHAR w_get (); /* Create temporary TLS path buf of size 2 * NT_MAX_PATH. */
31 inline char *t_get () { return (char *) w_get (); }
32 inline PUNICODE_STRING u_get (PUNICODE_STRING up)
34 up->Length = 0;
35 up->MaximumLength = (NT_MAX_PATH - 1) * sizeof (WCHAR);
36 up->Buffer = w_get ();
37 return up;