Commit Graph

306 Commits (d2dd29e80c89d8cc530a185e32e9025d0e453bb5)

Author SHA1 Message Date
Andrew Kelley d2dd29e80c separate os.Thread.Id and os.Thread.Handle because of windows 2018-08-06 17:25:24 -04:00
Andrew Kelley 0a3ae9dc6e fix std.os.Thread.getCurrentId for linux 2018-08-06 16:48:49 -04:00
Andrew Kelley 647fd0f4f1 Merge branch 'threadid' of https://github.com/mdsteele/zig into mdsteele-threadid 2018-08-06 16:12:37 -04:00
Andrea Orru 79d77faebf More type cast fixes 2018-08-06 02:42:12 -04:00
Andrea Orru 641066d82e Fix casts 2018-08-06 02:29:11 -04:00
Andrea Orru d2f5e57b68 Merge branch 'master' into zen_stdlib 2018-08-06 01:43:19 -04:00
Matthew D. Steele 7a2401ef1e Don't compare ?Thread.Id == Thread.Id in the test
It doesn't work, because of issue #1332.
2018-08-04 21:47:13 -04:00
kristopher tate a25824e033 zig/std/os/index.zig: clean-up thread id; (#1)
Ref #1316 #1330
2018-08-04 14:38:51 -04:00
Matthew D. Steele 86d1cc8e2f Add thread ID support to std.os.Thread (fixes #1316) 2018-08-03 21:36:04 -04:00
Matthew D. Steele dcaaa241df Fix a type error in std.os.linux.getpid() (#1326)
syscall0() returns usize, but we were trying to @bitCast to i32.
2018-08-03 11:45:23 -04:00
Andrew Kelley 729f2aceb0 fix API of RtlGenRandom 2018-08-02 13:34:31 -04:00
Andrew Kelley cbca434cf0 Merge branch 'windows-RtlGenRandom-issue1318' of https://github.com/kristate/zig into pr-1319 2018-08-02 13:26:02 -04:00
kristopher tate 782043e2e6 std/os/windows/util.zig: SKIP instead of PASS on non-windows systems;
Tracking Issue #1318 ;
2018-08-03 02:16:49 +09:00
kristopher tate dde7eb45c5 std/os/index.zig: call getRandomBytes() twice and compare;
Tracking Issue #1318 ;
2018-08-03 02:16:19 +09:00
kristopher tate c44653f40f std/os/index.zig: swap CryptGetRandom() with RtlGenRandom();
Tracking Issue #1318 ;
2018-08-03 02:14:52 +09:00
kristopher tate 22fd359e2c std/os/windows/advapi32.zig: add SystemFunction036;
Tracking Issue #1318 ;
2018-08-03 02:14:06 +09:00
kristopher tate 432b7685bf std/os/index.zig: use "hw.logicalcpu" instead of "hw.ncpu" in macOS; (#1317)
Tracking Issue #1252 ;

hw.ncpu was deprecated in macOS. Among 4 new options available (hw.{physicalcpu, physicalcpu_max, logicalcpu, logicalcpu_max}), hw.logicalcpu was chosen because it actually reflects the number of logical cores the OS sees.
2018-08-02 12:59:59 -04:00
Andrew Kelley 72599d420b self-hosted: find all libc paths; windows linker code 2018-07-24 00:06:34 -04:00
Andrew Kelley 5a919dd82d Merge remote-tracking branch 'origin/master' into self-hosted-libc-hello-world 2018-07-23 14:32:13 -04:00
Andrew Kelley d767fae47e self-hosted: add first compare-output test 2018-07-23 00:35:53 -04:00
Andrew Kelley 20f286f22a re-organize std lib darwin files 2018-07-22 00:04:24 -04:00
kristopher tate 460c266216 std.os.posix: Add SOCK_* for darwin;
Tracking issue #1271;
2018-07-21 19:15:03 +09:00
kristopher tate 8062afcb31 std.os.posix: Add SYSPROTO_* for darwin;
Tracking issue #1271;
2018-07-21 19:14:40 +09:00
kristopher tate 7ef110b484 std.os.posix: Add AF_* for darwin;
Tracking issue #1271;
2018-07-21 19:14:14 +09:00
Andrew Kelley 58c5f94a99 self-hosted: share C++ code for finding libc on windows 2018-07-20 23:38:13 -04:00
Jimmi HC 1f4c7d5ebf Fixed windows getPos 2018-07-20 23:05:53 +02:00
Andrew Kelley 0736e6aa34 std.os.File: add missing pub modifiers 2018-07-19 13:06:13 -04:00
Andrew Kelley 3e4a3fa5b7 self-hosted: find libc on linux 2018-07-18 17:43:36 -04:00
Andrew Kelley cd488c9da5 fix std.os.getAppDataDir test on linux 2018-07-18 10:45:17 -04:00
Andrew Kelley a8a1b5af07 fix build on windows
* move getAppDataDir and utf16leToUtf8 from self-hosted to std lib
 * fix std.event.Loop on windows
2018-07-18 10:07:22 -04:00
Andrew Kelley 3bb00eac37 self-hosted: implement getAppDataDir for windows 2018-07-17 00:01:36 -04:00
Andrew Kelley e9a03cccf3 all integer sizes are available as primitives
* fix wrong implicit cast for `@IntType` bit_count parameter.
 * fix incorrect docs for `@IntType` bit_count parameter.

closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley ac096c2949 zig fmt 2018-07-12 19:24:32 -04:00
Andrew Kelley 3f4d0ecd7e Merge remote-tracking branch 'origin/master' into m-n-threading 2018-07-09 17:14:42 -04:00
Andrew Kelley 9462852433 std.event.Loop multithreading for windows using IOCP 2018-07-09 16:49:46 -04:00
Andrew Kelley caa0085057 implement std.os.cpuCount for windows 2018-07-09 13:19:11 -04:00
Andrew Kelley 05f1ea33d2 ZIG_DEBUG_COLOR=1 overrides tty detection for runtime stack traces 2018-07-09 12:12:37 -04:00
Andrew Kelley a0c564d762 zig fmt 2018-07-09 01:23:47 -04:00
Andrew Kelley 04d3da4bd1 std.os.cpuCount implementation for macos 2018-07-09 01:08:33 -04:00
Andrew Kelley 50d70d5f49 tests passing with kqueue on macos 2018-07-08 02:46:10 -04:00
Andrew Kelley c15a6fa9d0 add std.os.cpuCount and have std.event.Loop use it for thread pool size 2018-07-07 01:23:18 -04:00
Andrew Kelley eb326e1553 M:N threading
* add std.atomic.QueueMpsc.isEmpty
 * make std.debug.global_allocator thread-safe
 * std.event.Loop: now you have to choose between
   - initSingleThreaded
   - initMultiThreaded
 * std.event.Loop multiplexes coroutines onto kernel threads
 * Remove std.event.Loop.stop. Instead the event loop run() function
   returns once there are no pending coroutines.
 * fix crash in ir.cpp for calling methods under some conditions
 * small progress self-hosted compiler, analyzing top level declarations
 * Introduce std.event.Lock for synchronizing coroutines
 * introduce std.event.Locked(T) for data that only 1 coroutine should
   modify at once.
 * make the self hosted compiler use multi threaded event loop
 * make std.heap.DirectAllocator thread-safe

See #174

TODO:
 * call sched_getaffinity instead of hard coding thread pool size 4
 * support for Windows and MacOS
 * #1194
 * #1197
2018-07-07 00:32:19 -04:00
Andrew Kelley 85f928f8bf remove std.mem.Allocator.construct and other fixups 2018-06-20 17:33:29 -04:00
Andrew Kelley e891f9cd9d zig fmt 2018-06-20 17:16:27 -04:00
kristopher tate 71db8df548 std: update stdlib to match updated allocator create signature; ref #733 2018-06-21 00:40:21 +09:00
Andrew Kelley 626b73e8be remove error to/from int casting syntax; add `@errorToInt`/`@intToError`
See #1061
2018-06-18 18:48:29 -04:00
Andrew Kelley a430853a48 standard library fixes 2018-06-18 17:43:01 -04:00
Andrew Kelley 1aafbae5be remove []u8 casting syntax. add `@bytesToSlice` and `@sliceToBytes`
See #1061
2018-06-18 17:25:29 -04:00
Andrew Kelley 7912061226 remove integer and float casting syntax
* add `@intCast`
 * add `@floatCast`
 * add `@floatToInt`
 * add `@intToFloat`

See #1061
2018-06-17 02:57:07 -04:00
Andrew Kelley 3ee4d23ebd posix read can return error.IsDir 2018-06-16 19:54:16 -04:00