mirror of
https://github.com/php-win-ext/pecl-system-sync.git
synced 2026-03-24 09:02:17 +01:00
Compare commits
7 Commits
pie-suppor
...
v1.1.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fcd998288 | ||
|
|
4c9a9d9654 | ||
|
|
b83f97d579 | ||
|
|
41c71ac01c | ||
|
|
b69a7755cd | ||
|
|
435592d610 | ||
|
|
ecb7e8dfd7 |
46
.github/workflows/build.yml
vendored
Normal file
46
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: Publish Windows Releases
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
get-extension-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.extension-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
- name: Get the extension matrix
|
||||
id: extension-matrix
|
||||
uses: php/php-windows-builder/extension-matrix@v1
|
||||
build:
|
||||
needs: get-extension-matrix
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: false
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
- name: Build the extension
|
||||
uses: php/php-windows-builder/extension@v1
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
arch: ${{ matrix.arch }}
|
||||
ts: ${{ matrix.ts }}
|
||||
args: '--enable-sync'
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: ${{ github.event_name == 'release' }}
|
||||
steps:
|
||||
- name: Upload artifact to the release
|
||||
uses: php/php-windows-builder/release@v1
|
||||
with:
|
||||
release: ${{ github.event.release.tag_name }}
|
||||
# token: ${{ secrets.GITHUB_TOKEN }}
|
||||
30
README.md
30
README.md
@@ -1,4 +1,4 @@
|
||||
CubicleSoft PHP Extension: Synchronization Objects (sync)
|
||||
CubicleSoft PHP Extension: Synchronization Objects (sync)
|
||||
==========================================================
|
||||
|
||||
The 'sync' extension introduces synchronization objects into PHP. Named and unnamed Mutex, Semaphore, Event, Reader-Writer, and named Shared Memory objects provide OS-level synchronization mechanisms on both *NIX (POSIX shared memory and pthread shared memory synchronization required) and Windows platforms. The extension comes with a test suite that integrates cleanly into 'make test'.
|
||||
@@ -7,6 +7,34 @@ The 'sync' extension is a direct port of and compatible with the cross platform
|
||||
|
||||
This extension uses the liberal MIT open source license. And, of course, it sits on GitHub for all of that pull request and issue tracker goodness to easily submit changes and ideas respectively.
|
||||
|
||||
|
||||
|
||||
| Version | Status |
|
||||
|---------|------------------------------|
|
||||
| master | unmaintened :x: |
|
||||
| v1.x | maintened :white_check_mark: |
|
||||
|
||||
Maintained PHP Versions compatibility:
|
||||
|
||||
| PHP Version | Status |
|
||||
|-------------|------------------------|
|
||||
| 5.x | no :x: |
|
||||
| 7.x | no :x: |
|
||||
| 8.0 | yes :white_check_mark: |
|
||||
| 8.1 | yes :white_check_mark: |
|
||||
| 8.2 | yes :white_check_mark: |
|
||||
| 8.3 | yes :white_check_mark: |
|
||||
| 8.4 | yes :white_check_mark: |
|
||||
| 8.5 | yes :white_check_mark: |
|
||||
|
||||
Installation system support:
|
||||
|
||||
| Platform | Status |
|
||||
|----------|------------------------|
|
||||
| PECL | no :x: |
|
||||
| PIE | yes :white_check_mark: |
|
||||
|
||||
|
||||
Details
|
||||
-------
|
||||
|
||||
|
||||
9
composer.json
Normal file
9
composer.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "php-win-ext/sync",
|
||||
"type": "php-ext",
|
||||
"license": "MIT",
|
||||
"description": "A PHP extension for Synchronization Objects (sync)",
|
||||
"require": {
|
||||
"php": ">= 8.0.0"
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
extern zend_module_entry sync_module_entry;
|
||||
#define phpext_sync_ptr &sync_module_entry
|
||||
|
||||
#define PHP_SYNC_VERSION "1.1.3"
|
||||
#define PHP_SYNC_VERSION "1.1.4"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
# define PHP_SYNC_API __declspec(dllexport)
|
||||
|
||||
53
sync.c
53
sync.c
@@ -900,7 +900,11 @@ PHP_METHOD(sync_Mutex, __construct)
|
||||
obj->MxWinMutex = CreateMutexA(&SecAttr, FALSE, name);
|
||||
if (obj->MxWinMutex == NULL)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Mutex could not be created", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Mutex could not be created", 0 TSRMLS_CC);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -912,7 +916,11 @@ PHP_METHOD(sync_Mutex, __construct)
|
||||
|
||||
if (Result < 0)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Mutex could not be created", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Mutex could not be created", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -974,7 +982,12 @@ PHP_METHOD(sync_Mutex, lock)
|
||||
|
||||
if (pthread_mutex_lock(&obj->MxPthreadCritSection) != 0)
|
||||
{
|
||||
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Unable to acquire mutex critical section", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Unable to acquire mutex critical section", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1143,7 +1156,11 @@ PHP_METHOD(sync_Semaphore, __construct)
|
||||
obj->MxWinSemaphore = CreateSemaphoreA(&SecAttr, (LONG)initialval, (LONG)initialval, name);
|
||||
if (obj->MxWinSemaphore == NULL)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Semaphore could not be created", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Semaphore could not be created", 0 TSRMLS_CC);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1155,7 +1172,11 @@ PHP_METHOD(sync_Semaphore, __construct)
|
||||
|
||||
if (Result < 0)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Semaphore could not be created", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Semaphore could not be created", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1357,7 +1378,11 @@ PHP_METHOD(sync_Event, __construct)
|
||||
obj->MxWinWaitEvent = CreateEventA(&SecAttr, (BOOL)manual, (prefire ? TRUE : FALSE), name);
|
||||
if (obj->MxWinWaitEvent == NULL)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Event object could not be created", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Event object could not be created", 0 TSRMLS_CC);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1369,7 +1394,11 @@ PHP_METHOD(sync_Event, __construct)
|
||||
|
||||
if (Result < 0)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Event object could not be created", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Event object could not be created", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1706,7 +1735,11 @@ PHP_METHOD(sync_ReaderWriter, __construct)
|
||||
|
||||
if (obj->MxWinRSemMutex == NULL || obj->MxWinRSemaphore == NULL || obj->MxWinRWaitEvent == NULL || obj->MxWinWWaitMutex == NULL)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Reader-Writer object could not be created", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Reader-Writer object could not be created", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1719,7 +1752,11 @@ PHP_METHOD(sync_ReaderWriter, __construct)
|
||||
|
||||
if (Result < 0)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Reader-Writer object could not be created", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Reader-Writer object could not be created", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2053,7 +2090,11 @@ PHP_METHOD(sync_SharedMemory, __construct)
|
||||
|
||||
if (name_len < 1)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "An invalid name was passed", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "An invalid name was passed", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2077,7 +2118,11 @@ PHP_METHOD(sync_SharedMemory, __construct)
|
||||
|
||||
if (obj->MxFile == NULL)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Shared memory file mapping could not be created/opened", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Shared memory file mapping could not be created/opened", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2093,7 +2138,11 @@ PHP_METHOD(sync_SharedMemory, __construct)
|
||||
|
||||
if (obj->MxMem == NULL)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Shared memory segment could not be mapped", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Shared memory segment could not be mapped", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2107,7 +2156,11 @@ PHP_METHOD(sync_SharedMemory, __construct)
|
||||
|
||||
if (Result < 0)
|
||||
{
|
||||
#if PHP_VERSION_ID < 80500
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Shared memory object could not be created/opened", 0 TSRMLS_CC);
|
||||
#else
|
||||
zend_throw_exception(zend_ce_exception, "Shared memory object could not be created/opened", 0 TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user