Skip to content

Commit

Permalink
Document a new/recoded stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1maker committed Dec 7, 2024
1 parent d773378 commit e1b3170
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 2 deletions.
25 changes: 25 additions & 0 deletions docs/Foundation/Namespaces/Global/Classes/fast_mutex.md
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.
25 changes: 25 additions & 0 deletions docs/Foundation/Namespaces/Global/Classes/mutex.md
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.
17 changes: 17 additions & 0 deletions docs/Foundation/Namespaces/Global/Classes/named_mutex.md
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.
3 changes: 2 additions & 1 deletion docs/Foundation/Namespaces/Global/Classes/thread.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ The `thread` class provides a data structure for managing and controlling thread

## Constructors

### `thread(thread_func@ func)`
### `thread(thread_func@ func, dictionary@ args = null)`
- **Parameters**:
- `func` (thread_func@): A function to be executed by the new thread.
- `args` (dictionary@): A dictionary with arguments handled by thread_func.
- **Description**: Constructs a new `thread` object and starts executing the specified function in a separate thread.

## Methods
Expand Down
2 changes: 1 addition & 1 deletion docs/Foundation/Namespaces/Global/Funcdefs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

### thread_func
- **Return Type**: `void`
- **Parameters**: None
- **Parameters**: dictionary@ args
- **Description**: This function defines the entry point for a new thread. It is responsible for the execution of tasks within that thread.
53 changes: 53 additions & 0 deletions docs/Foundation/Namespaces/filesystem/Functions.md
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.
9 changes: 9 additions & 0 deletions docs/Foundation/Namespaces/this_thread/Functions.md
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.
16 changes: 16 additions & 0 deletions docs/Helper/instance.md
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.

0 comments on commit e1b3170

Please sign in to comment.