You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* {{{ proto boolean Thread::start([boolean sync])
338
352
Starts executing your implemented run method in a thread, will return a boolean indication of success
339
-
If sync is true, your new thread runs synchronized with the current thread until you call notify from within the new thread or the thread ends
353
+
If sync is true, your new thread runs synchronized with the current thread ( causing the current thread to block ) until you call notify from within the new thread or the thread ends
340
354
If sync is false or void, the new thread will run asynchronously to the current thread and this call will return as quickly as possible */
341
355
PHP_METHOD(Thread, start)
342
356
{
@@ -500,6 +514,25 @@ PHP_METHOD(Thread, isBusy)
500
514
}
501
515
} /* }}} */
502
516
517
+
/* {{{ proto boolean Thread::isWaiting()
518
+
Will return true if the referenced thread is waiting for notification */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tid)==SUCCESS) {
642
-
if (tid&&tid>0L) {
643
-
if ((found=PTHREADS_FIND((unsigned long)tid))!=NULL) {
644
-
if (!PTHREADS_IS_CREATOR(found)) {
645
-
if (PTHREADS_IMPORT(found, &return_valueTSRMLS_CC)) {
646
-
return;
647
-
} elsezend_error(E_WARNING, "pthreads has detected that Thread::getThread(%lu) has failed", tid);
648
-
} elsezend_error(E_WARNING, "pthreads has detected that Thread::getThread(%lu) has nothing to import as the requested thread was created in the current", tid);
649
-
RETURN_FALSE;
650
-
} elsezend_error(E_WARNING, "pthreads has detected that Thread::getThread(%lu) has nothing to import as the requested thread is no longer running", tid);
651
-
} elsezend_error(E_WARNING, "pthreads has detected incorrect use of Thread::getThread, no valid Thread identifier was specified");
652
-
}
653
-
} elsezend_error(E_WARNING, "pthreads has detected incorrect use of Thread::getThread, this method may only be called statically as Thread::getThread");
673
+
if (pthreads_import_entry!=NULL) {
674
+
if (EG(called_scope) ==pthreads_class_entry) {
675
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tid)==SUCCESS) {
676
+
if (tid&&tid>0L) {
677
+
if ((found=PTHREADS_FIND((unsigned long)tid))!=NULL) {
678
+
if (!PTHREADS_IS_CREATOR(found)) {
679
+
if (PTHREADS_IMPORT(found, &return_valueTSRMLS_CC)) {
680
+
return;
681
+
} elsezend_error(E_WARNING, "pthreads has detected that Thread::getThread(%lu) has failed", tid);
682
+
} elsezend_error(E_WARNING, "pthreads has detected that Thread::getThread(%lu) has nothing to import as the requested thread was created in the current", tid);
683
+
RETURN_FALSE;
684
+
} elsezend_error(E_WARNING, "pthreads has detected that Thread::getThread(%lu) has nothing to import as the requested thread is no longer running", tid);
685
+
} elsezend_error(E_WARNING, "pthreads has detected incorrect use of Thread::getThread, no valid Thread identifier was specified");
686
+
}
687
+
} elsezend_error(E_WARNING, "pthreads has detected incorrect use of Thread::getThread, this method may only be called statically as Thread::getThread");
688
+
} elsezend_error(E_WARNING, "pthreads has detected an attempt to use a prohibited method (Thread::getThread), importing Threads is disabled in this environment");
Copy file name to clipboardExpand all lines: pthreads_object.h
-6Lines changed: 0 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -22,12 +22,6 @@
22
22
* NOTES
23
23
* 1. Not happy with inability to detect scope properly in Threads, too many annoyances to be acceptable
24
24
* 2. Private/Protected Members in user declared Threads not working properly as a result of the above
25
-
*
26
-
* TODO
27
-
* 1. Importer Functionality
28
-
* 2. Attempt to import the definition, perhaps internalize the class in the creating thread so that $this in the threading context can initialize in a more compatible manor, this should fix scoping issues by proxy
29
-
* 3. Test thoroughly synchronization routines, ensure that imported threads will function, ensure bits aren't set when they shouldn't be on state
30
-
* 4. User defined functions should be imported with imports, concurrency poses a problem, it could be left up to the user to use mutex and locking ... keep thinking ...
0 commit comments