Skip to content

Commit

Permalink
Partially working main draft
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfriend99 committed Oct 12, 2024
1 parent 6b725ce commit aeb7542
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 838 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: CI

on:
push:
branches: [ dev, threads ]
branches-ignore:
- main
pull_request:
branches: [ main ]

Expand Down
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,19 @@ if(UNIX)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_link_libraries(libblade PRIVATE dl)
endif()
endif(UNIX)

target_link_libraries(libblade PRIVATE pthread)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(libblade PRIVATE Threads::Threads)
# target_link_libraries(libblade PRIVATE pthread)
endif(UNIX)

if(WIN32)
add_dependencies(libblade mman)
target_link_libraries(libblade PRIVATE mman)

find_package(PThreads4W REQUIRED)
target_link_libraries(libblade PRIVATE PThreads4W::PThreads4W)
endif()

target_link_libraries(blade PRIVATE libblade)
Expand Down
4 changes: 2 additions & 2 deletions src/standard/thread.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "module.h"
#include "threads.h"
#include <pthread.h>

static uint64_t last_thread_vm_id = 0;

Expand Down Expand Up @@ -119,7 +119,7 @@ DECLARE_MODULE_METHOD(thread__run) {
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 64 * 1024); // Reduce stack size to 8KB

if(pthread_create((pthread_t *)thread->thread, NULL, b_thread_callback_function, thread) == thrd_success) {
if(pthread_create((pthread_t *)thread->thread, NULL, b_thread_callback_function, thread) == 0) {
pthread_attr_destroy(&attr);
RETURN_NAMED_PTR(thread, B_THREAD_PTR_NAME);
}
Expand Down
2 changes: 0 additions & 2 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ endif()
if(WIN32)
add_subdirectory(mman-win32)
endif()

add_subdirectory(threads)
6 changes: 0 additions & 6 deletions thirdparty/threads/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion thirdparty/threads/threads.c

This file was deleted.

Loading

0 comments on commit aeb7542

Please sign in to comment.