-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a task scheduler for background indexing and preparation
The scheduler isn’t actually being used yet but it’s complex and generic enough that it’s possible to review it by itself.
- Loading branch information
Showing
9 changed files
with
887 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_library(CAtomics INTERFACE) | ||
target_include_directories(CAtomics INTERFACE "include") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors | ||
// Licensed under Apache License v2.0 with Runtime Library Exception | ||
// | ||
// See https://swift.org/LICENSE.txt for license information | ||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef SOURCEKITLSP_CATOMICS_H | ||
#define SOURCEKITLSP_CATOMICS_H | ||
|
||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <sys/types.h> | ||
|
||
// MARK: - AtomicBool | ||
|
||
typedef struct { | ||
_Atomic(bool) value; | ||
} AtomicBool; | ||
|
||
__attribute__((swift_name("AtomicBool.init(initialValue:)"))) | ||
static inline AtomicBool atomic_bool_create(bool initialValue) { | ||
AtomicBool atomic; | ||
atomic.value = initialValue; | ||
return atomic; | ||
} | ||
|
||
__attribute__((swift_name("getter:AtomicBool.value(self:)"))) | ||
static inline bool atomic_bool_get(AtomicBool *atomic) { | ||
return atomic->value; | ||
} | ||
|
||
__attribute__((swift_name("setter:AtomicBool.value(self:_:)"))) | ||
static inline void atomic_bool_set(AtomicBool *atomic, bool newValue) { | ||
atomic->value = newValue; | ||
} | ||
|
||
// MARK: - AtomicUInt8 | ||
|
||
typedef struct { | ||
_Atomic(uint8_t) value; | ||
} AtomicUInt8; | ||
|
||
__attribute__((swift_name("AtomicUInt8.init(initialValue:)"))) | ||
static inline AtomicUInt8 atomic_uint8_create(uint8_t initialValue) { | ||
AtomicUInt8 atomic; | ||
atomic.value = initialValue; | ||
return atomic; | ||
} | ||
|
||
__attribute__((swift_name("getter:AtomicUInt8.value(self:)"))) | ||
static inline uint8_t atomic_uint8_get(AtomicUInt8 *atomic) { | ||
return atomic->value; | ||
} | ||
|
||
__attribute__((swift_name("setter:AtomicUInt8.value(self:_:)"))) | ||
static inline void atomic_uint8_set(AtomicUInt8 *atomic, uint8_t newValue) { | ||
atomic->value = newValue; | ||
} | ||
|
||
#endif // SOURCEKITLSP_CATOMICS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module CAtomics { | ||
header "CAtomics.h" | ||
export * | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.