-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
148 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## Fast Mutex Operations | ||
|
||
### `fast_mutex()` | ||
- **Return Type**: fast_mutex@ | ||
- **Description**: Constructs a new fast mutex object. This type of mutex is designed for higher performance than regular mutexes, particularly in scenarios with frequent lock contention. | ||
|
||
### `void lock(int milliseconds)` | ||
- **Return Type**: void | ||
- **Description**: Acquires the fast mutex. If the mutex is already locked by another thread, this will block for up to `milliseconds` before timing out and returning. | ||
|
||
### `bool try_lock(int milliseconds)` | ||
- **Return Type**: bool | ||
- **Description**: Attempts to acquire the fast mutex without blocking. Returns true if the mutex was successfully acquired within `milliseconds`; otherwise, returns false immediately. | ||
|
||
### `void lock()` | ||
- **Return Type**: void | ||
- **Description**: Acquires the fast mutex, similar to the overload with an integer parameter. If the mutex is already locked by another thread, this will block indefinitely until the lock becomes available. | ||
|
||
### `bool try_lock()` | ||
- **Return Type**: bool | ||
- **Description**: Attempts to acquire the fast mutex without blocking, as per the integer-parameter version. Returns true if the mutex was successfully acquired within an unspecified amount of time; otherwise, returns false immediately. | ||
|
||
### `void unlock()` | ||
- **Return Type**: void | ||
- **Description**: Releases the lock on the fast mutex that is currently held by the calling thread, allowing other threads waiting to acquire it to proceed. |
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,25 @@ | ||
## Mutex Operations | ||
|
||
### `mutex()` | ||
- **Return Type**: mutex@ | ||
- **Description**: Constructs a new mutex object. | ||
|
||
### `void lock(int milliseconds)` | ||
- **Return Type**: void | ||
- **Description**: Acquires the mutex. If the mutex is already locked by another thread, this will block for up to `milliseconds` before timing out and returning. | ||
|
||
### `bool try_lock(int milliseconds)` | ||
- **Return Type**: bool | ||
- **Description**: Attempts to acquire the mutex without blocking. Returns true if the mutex was successfully acquired within `milliseconds`; otherwise, returns false immediately. | ||
|
||
### `void lock()` | ||
- **Return Type**: void | ||
- **Description**: Acquires the mutex, similar to the overload with an integer parameter. If the mutex is already locked by another thread, this will block indefinitely until the lock becomes available. | ||
|
||
### `bool try_lock()` | ||
- **Return Type**: bool | ||
- **Description**: Attempts to acquire the mutex without blocking, as per the integer-parameter version. Returns true if the mutex was successfully acquired within an unspecified amount of time; otherwise, returns false immediately. | ||
|
||
### `void unlock()` | ||
- **Return Type**: void | ||
- **Description**: Releases the lock on the mutex that is currently held by the calling thread, allowing other threads waiting to acquire it to proceed. |
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,17 @@ | ||
## Named Mutex Operations | ||
|
||
### `named_mutex(const string&in name)` | ||
- **Return Type**: named_mutex@ | ||
- **Description**: Constructs a new named mutex object with the specified name. Named mutexes allow multiple threads or processes to synchronize access by referring to the same unique name. | ||
|
||
### `void lock()` | ||
- **Return Type**: void | ||
- **Description**: Acquires the named mutex. If the mutex is already locked by another thread or process, this will block until the lock becomes available. | ||
|
||
### `bool try_lock()` | ||
- **Return Type**: bool | ||
- **Description**: Attempts to acquire the named mutex without blocking. Returns true if the mutex was successfully acquired; otherwise, returns false immediately. | ||
|
||
### `void unlock()` | ||
- **Return Type**: void | ||
- **Description**: Releases the lock on the named mutex that is currently held by the calling thread or process, allowing other threads or processes waiting to acquire it to proceed. |
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
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,53 @@ | ||
## Filesystem Information | ||
|
||
### `bool exists(const string&in path)` | ||
- **Return Type**: bool | ||
- **Description**: Checks if the specified file or directory exists at the given path. Returns true if it exists; otherwise, returns false. | ||
|
||
### `bool is_directory(const string&in path)` | ||
- **Return Type**: bool | ||
- **Description**: Determines if the specified path refers to a directory. Returns true if it does; otherwise, returns false. | ||
|
||
### `string get_current_path() property` | ||
- **Return Type**: string | ||
- **Description**: Retrieves the current working directory of the application as a property. | ||
|
||
### `void set_current_path(const string&in path) property` | ||
- **Return Type**: void | ||
- **Description**: Changes the current working directory to the specified new path. The method does not return any value. | ||
|
||
### `void list_directory(const string&in path = current_path, array<string>@ files = null, array<string>@ folders = null, const string&in pattern = '*')` | ||
- **Return Type**: void | ||
- **Description**: Lists all files and directories in the specified path that match the given pattern. If no arrays are provided for storing results, the method will not store them. | ||
|
||
### `bool create_directory(const string&in path)` | ||
- **Return Type**: bool | ||
- **Description**: Creates a new directory at the specified path. Returns true if the directory is successfully created; otherwise, returns false. | ||
|
||
### `bool remove(const string&in path)` | ||
- **Return Type**: bool | ||
- **Description**: Deletes the file or directory at the specified path. If a directory is deleted and it contains files, those files will also be removed. Returns true if the operation is successful; otherwise, returns false. | ||
|
||
### `bool rename(const string&in old, const string&in new)` | ||
- **Return Type**: bool | ||
- **Description**: Renames a file or directory from its current name to a new one. Returns true if the operation is successful; otherwise, returns false. | ||
|
||
### `string get_file_extension(const string&in path)` | ||
- **Return Type**: string | ||
- **Description**: Extracts and returns the extension (including the dot) of the specified file path. | ||
|
||
### `bool copy(const string&in source, const string&in des)` | ||
- **Return Type**: bool | ||
- **Description**: Copies a file from the source to the destination. Returns true if the operation is successful; otherwise, returns false. | ||
|
||
### `bool move(const string&in source, const string&in des)` | ||
- **Return Type**: bool | ||
- **Description**: Moves a file or directory from the source path to the destination path. Similar to renaming but can also be used for moving directories across drives. Returns true if the operation is successful; otherwise, returns false. | ||
|
||
### `uint64 get_file_size(const string&in path)` | ||
- **Return Type**: uint64 | ||
- **Description**: Retrieves and returns the size of the specified file in bytes. | ||
|
||
### `datetime get_last_modified_time(const string&in path)` | ||
- **Return Type**: datetime | ||
- **Description**: Returns the last modified time for the specified file or directory. |
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,9 @@ | ||
## Current thread Information | ||
|
||
### `void yield()` | ||
- **Return Type**: void | ||
- **Description**: Yields control to another thread by placing the current thread at the end of the queue for threads ready to run, allowing other threads to run. | ||
|
||
### `int get_id() property` | ||
- **Return Type**: int | ||
- **Description**: Retrieves the unique identifier of the currently executing thread as a property. |
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,16 @@ | ||
# Class: instance | ||
|
||
The `instance` class provides a data structure for managing an application instance. It allows you to check if the instance is currently running. | ||
|
||
## Constructors | ||
|
||
### `instance(const string&in application_name)` | ||
- **Parameters**: | ||
- `application_name` (const string&): The name of the application. | ||
- **Description**: Constructs a new `instance` object and attempts to manage the specified application instance. | ||
|
||
## Methods | ||
|
||
### `bool is_running()` | ||
- **Return Type**: bool | ||
- **Description**: Returns whether the managed application instance is currently running. |