aboutsummaryrefslogtreecommitdiff
path: root/core/sys
Commit message (Collapse)AuthorAgeFilesLines
...
* Change sizes of pthread types for freebsdChristian Seibold2020-09-141-14/+12
|
* Get Odin compiling and produced exe's running on FreeBSDChristian Seibold2020-09-141-0/+125
|
* [REFLECTION BREAKING] Modify the internals of the `map` type to increase ↵gingerBill2020-09-071-0/+2
| | | | performance
* Add sys/windows/synchronization.odingingerBill2020-08-021-0/+10
|
* Update package syncgingerBill2020-08-021-0/+1
|
* Fix pthread_t on Macos.Clay Murray2020-07-111-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From some testing with directly using C code, pthread_t on macos is 8 bytes. This is my test code: ``` #include <assert.h> #include <stdio.h> #include <pthread.h> void* PosixThreadMainRoutine(void* data) { // Do some work here. for (int i = 0; i < 2000000000; i++) { } return NULL; } pthread_t LaunchThread() { // Create the thread using POSIX routines. pthread_attr_t attr; pthread_t posixThreadID; int returnVal; returnVal = pthread_attr_init(&attr); assert(!returnVal); returnVal = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); assert(!returnVal); int threadError = pthread_create(&posixThreadID, &attr, &PosixThreadMainRoutine, NULL); returnVal = pthread_attr_destroy(&attr); assert(!returnVal); if (threadError != 0) { // Report an error. } return posixThreadID; } int main() { pthread_t t = LaunchThread(); void ** ret; printf("%d, %d\n", sizeof(t), sizeof(pthread_t)); int val = pthread_join(t, ret); printf("%d", val); return 0; } ``` running this on macos reports `8, 8`. Then I made the proposed changes and errors I was having with threads completely went away.
* Fix double declarationgingerBill2020-07-101-1/+0
|
* Fix new `package path`gingerBill2020-07-101-0/+7
|
* Merge pull request #339 from dotbmp/mastergingerBill2020-07-101-0/+9
|\ | | | | "core:path" Path library and "core:strings" `split` Utilities
| * Merge branch 'master' into masterBrendan Punsky2019-03-181-7/+17
| |\
| * | Fix typoBrendan Punsky2019-03-131-1/+1
| | |
| * | Merge branch 'master' into masterBrendan Punsky2019-03-134-5/+159
| |\ \
| * | | Update kernel32.odinBrendan Punsky2019-03-131-0/+9
| | | | | | | | | | | | Add Win32 path functions
* | | | Update thread_unix logicgingerBill2020-06-271-1/+1
| | | |
* | | | Update `sys/unix`; Rename `thread.create_and_start`gingerBill2020-06-273-1/+12
| | | |
* | | | Update sys/windows; Add sync.Blocking_Mutex (windows only at the moment)gingerBill2020-06-272-2/+5
| | | |
* | | | Add more exception handling stuff to sys/windowsgingerBill2020-06-262-3/+19
| | | |
* | | | Update sys/windowsgingerBill2020-06-262-5/+4
| | | |
* | | | Begin migration from sys/win32 to sys/windowsgingerBill2020-06-2610-6/+1178
| | | |
* | | | Add some tests to test utf16_to_utf8 and wstring_to_utf8vassvik2020-06-131-0/+44
| | | |
* | | | Reworked win32.utf16_to_utf8 and win32.wstring_to_utf8 to scan for zeros ↵vassvik2020-06-131-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from the start of the string instead of from the end. This is useful to correctly convert strings from a buffer possibly containing multiple multiple substrings. The resulting utf8 string is not null terminated, even if the backing memory might be null terminated.
* | | | Add wstring_to_utf8 to sys/win32vassvik2020-06-121-11/+18
| | | |
* | | | Fix off by one bug introduced in the previous commit.vassvik2020-06-121-2/+2
| | | |
* | | | Add extra NUL termination check for string length in win32 general string ↵gingerBill2020-06-121-3/+8
| | | | | | | | | | | | | | | | convertors
* | | | Add `package sys/llvm` to expose some of the LLVM intrinsicsgingerBill2020-06-063-0/+331
| | | |
* | | | Fix errors in `package win32`gingerBill2020-04-302-3/+5
| | | |
* | | | Fixed duplicated WHITENESS value in BLACKNESS constantJoe2020-03-291-1/+1
| | | |
* | | | -Win32-Joe2020-03-293-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New - Constants: WHITENESS & BLACKNESS, and WM_PAINT - Methods: pat_blt, register_class_a, register_class_w, message_box_a, message_box_w, begin_paint, and end_paint - Structs: Wnd_Class_A, Wnd_Class_W, Paint_Struct Modified - WM_INPUT : Capitalized alphabetical values for consistency with other values
* | | | Revert os_windows.odin behaviourgingerBill2020-03-121-7/+7
| | | |
* | | | Fix os.read / os.read_entire_fileTetralux2020-03-121-2/+2
| | | | | | | | | | | | | | | | | | | | - DWORDs are NOT i32 - os.read didn't correctly read as much as it could
* | | | Add os.get_current_directory / os.set_current_directoryTetralux2020-01-201-0/+5
| | | |
* | | | added note about pthread_yieldKTRosenberg2020-01-021-0/+2
| | | |
* | | | replaced pthread_yield with ssched_yield, fixed semaphore post:qKTRosenberg2020-01-022-1/+4
| | | |
* | | | Add `thread.Pool` with example in demo.odin; Update linalg to support ↵gingerBill2020-01-021-1/+3
| | | | | | | | | | | | | | | | handness changes for projection matrices
* | | | Make the `string` type elements "immutable", akin to `char const *` in CgingerBill2019-12-011-2/+4
| | | | | | | | | | | | | | | | Allows for extra security and optimization benefits
* | | | Implement core:thread and core:sync on Unix using pthreadsTetralux2019-12-016-0/+342
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also do some cleanup and refactoring of the thread, sync and time APIs. - remove 'semaphore_release' because 'post' and 'wait' is easier to understand - change 'semaphore_wait' to '*_wait_for' to match Condition - pthreads can be given a stack, but doing so requires the user to set up the guard pages manually. BE WARNED. The alignment requirements of the stack are also platform-dependant; it may need to be page size aligned on some systems. Unclear which systems, however. See 'os.get_page_size', and 'mem.make_aligned'. HOWEVER: I was unable to get custom stacks with guard pages working reliably, so while you can do it, the API does not support it. - add 'os.get_page_size', 'mem.make_aligned', and 'mem.new_aligned'. - removed thread return values because windows and linux are not consistent; windows returns 'i32' and pthreads return 'void*'; besides which, if you really wanted to communicate how the thread exited, you probably wouldn't do it with the thread's exit code. - fixed 'thread.is_done' on Windows; it didn't report true immediately after calling 'thread.join'. - moved time related stuff out of 'core:os' to 'core:time'. - add 'mem.align_backward' - fixed default allocator alignment The heap on Windows, and calloc on Linux, both have no facility to request alignment. It's a bit of hack, but the heap_allocator now overallocates; `size + alignment` bytes, and aligns things to at least 2. It does both of these things to ensure that there is at least two bytes before the payload, which it uses to store how much padding it needed to insert in order to fulfil the alignment requested. - make conditions more sane by matching the Windows behaviour. The fact that they were signalled now lingers until a thread tries to wait, causing them to just pass by uninterrupted, without sleeping or locking the underlying mutex, as it would otherwise need to do. This means that a thread no longer has to be waiting in order to be signalled, which avoids timing bugs that causes deadlocks that are hard to debug and fix. See the comment on the `sync.Condition.flag` field. - add thread priority: `thread.create(worker_proc, .High)`
* | | | New Essence OS layer; cross-compiling improvementsnakst2019-09-021-24/+0
| | | |
* | | | Fix parsing for procedure literals expression statements; improve assert ↵gingerBill2019-07-282-2/+2
| | | | | | | | | | | | | | | | performance; other minor fixes
* | | | Make procedure parameters just named values rather than copied variablesgingerBill2019-07-153-10/+9
| | | |
* | | | call_external_process cleanupJeroen van Rijn2019-04-051-20/+14
| | | |
* | | | Add helpers to launch process and open website.Jeroen van Rijn2019-04-051-0/+35
| | | |
* | | | `@(private)` for `foreign` blocks; Improve foreign signature similarity rulesgingerBill2019-03-241-2/+2
| |_|/ |/| |
* | | Fix `using import` behaviour - #352gingerBill2019-03-171-1/+2
| | |
* | | Add -pdb-name for custom names of PDBsgingerBill2019-03-141-6/+15
| |/ |/|
* | Stylistic improvements to new comdlg helpers.Jeroen van Rijn2019-03-091-24/+33
| |
* | Add convenience functions for open + save dialogs.Jeroen van Rijn2019-03-091-2/+89
| |
* | Add win32.get_cwd to return the current working directoryJeroen van Rijn2019-03-092-0/+17
| |
* | package dynlibgingerBill2019-03-031-1/+1
| |
* | Add minor additions to mem, sync, and sys/win32gingerBill2019-02-211-2/+43
|/
* Initial support for GetVersionExAJeroen van Rijn2019-01-182-24/+41
|