mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Make posix_spawn faster on Windows
This commit is contained in:
parent
d6f72aa4a6
commit
ec957491ea
15 changed files with 514 additions and 123 deletions
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/atomic.h"
|
||||
#include "libc/cosmo.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
|
@ -35,7 +36,7 @@
|
|||
*
|
||||
* @return 0 on success, or errno on error
|
||||
*/
|
||||
errno_t cosmo_once(_Atomic(uint32_t) *once, void init(void)) {
|
||||
errno_t cosmo_once(atomic_uint *once, void init(void)) {
|
||||
uint32_t old;
|
||||
switch ((old = atomic_load_explicit(once, memory_order_relaxed))) {
|
||||
case INIT:
|
||||
|
|
|
@ -30,13 +30,12 @@ __msabi extern typeof(CreateDirectory) *const __imp_CreateDirectoryW;
|
|||
* @return handle, or -1 on failure
|
||||
* @note this wrapper takes care of ABI, STRACE(), and __winerr()
|
||||
*/
|
||||
textwindows bool32
|
||||
CreateDirectory(const char16_t *lpPathName,
|
||||
struct NtSecurityAttributes *lpSecurityAttributes) {
|
||||
textwindows bool32 CreateDirectory(const char16_t *lpPathName,
|
||||
struct NtSecurityAttributes *lpSecurity) {
|
||||
bool32 ok;
|
||||
ok = __imp_CreateDirectoryW(lpPathName, lpSecurityAttributes);
|
||||
ok = __imp_CreateDirectoryW(lpPathName, lpSecurity);
|
||||
if (!ok) __winerr();
|
||||
NTTRACE("CreateDirectory(%#hs, %s) → %hhhd% m", lpPathName,
|
||||
DescribeNtSecurityAttributes(lpSecurityAttributes), ok);
|
||||
DescribeNtSecurityAttributes(lpSecurity), ok);
|
||||
return ok;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue