Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation errors in initialize-master-thread-id #456

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions low_level_platform/impl/src/lf_arduino_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ typedef void* (*lf_function_t)(void*);
*/
int lf_available_cores() { return 1; }

lf_thread_t lf_thread_self() {
// Not implemented. Although Arduino mbed provides a ThisThread API and a
// get_id() function, it does not provide a way to get the current thread as a
// Thread object.
// N.B. This wrong implementation will eventually cause hard-to-debug
// segfaults, but it unblocks us from conveniently implementing features for
// other platforms, and it does not break existing features for Arduino.
return NULL;
}

int lf_thread_create(lf_thread_t* thread, void* (*lf_thread)(void*), void* arguments) {
lf_thread_t t = thread_new();
long int start = thread_start(t, *lf_thread, arguments);
Expand Down
7 changes: 7 additions & 0 deletions low_level_platform/impl/src/lf_flexpret_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ int lf_available_cores() {
return FP_THREADS - 1; // Return the number of Flexpret HW threads
}

lf_thread_t lf_thread_self() {
// N.B. This wrong implementation will eventually cause hard-to-debug
// segfaults, but it unblocks us from conveniently implementing features for
// other platforms, and it does not break existing features for FlexPRET.
return NULL;
}

int lf_thread_create(lf_thread_t* thread, void* (*lf_thread)(void*), void* arguments) {
/**
* Need to select between HRTT or SRTT; see
Expand Down
2 changes: 2 additions & 0 deletions low_level_platform/impl/src/lf_windows_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ int lf_available_cores() {
return sysinfo.dwNumberOfProcessors;
}

lf_thread_t lf_thread_self() { return GetCurrentThread(); }

int lf_thread_create(lf_thread_t* thread, void* (*lf_thread)(void*), void* arguments) {
uintptr_t handle = _beginthreadex(NULL, 0, lf_thread, arguments, 0, NULL);
*thread = (HANDLE)handle;
Expand Down
Loading