Daniel Kochmański
052155c6c3
ecl_thread_internal_error: add C api, protect get_env
...
Problem reported and fixed by Marius Gerbershagen. Fixes #382 .
2017-05-22 22:58:15 +02:00
Fabrizio Fabbri
a74094de9a
fix coverity issue Missing varargs init or cleanup
2017-05-17 23:20:10 +02:00
Fabrizio Fabbri
6c8449b147
fix coverity 435052 Dereference before null check
...
https://scan7.coverity.com/reports.htm#v29378/p15116/fileInstanceId=19259832&defectInstanceId=4445114&mergedDefectId=1435052
2017-05-17 21:11:26 +02:00
Kris Katterjohn
892a3e92f3
Remove some unused variables
2017-03-14 15:51:13 -05:00
Fabrizio Fabbri
4ed1ba10cc
Fix non msvc build broken by 5758af77
2017-01-11 08:16:07 +01:00
Fabrizio Fabbri
5758af7756
msvc: Compare thread id instead of handlers to check if it is already registered.
2017-01-10 10:42:27 +01:00
Daniel Kochmański
c1f485cc31
Simplify mp lambda lists
...
Remove redundant keyword-name specification from make-locks recursive
and remove dummy &key from barrier-wait (potentially not backward
compatible with C code).
2016-11-17 23:00:17 +01:00
Daniel Kochmański
fe0453fc08
explicitly cast original in queue.d
...
original is declared as volatile, but pthread_* discards this
qualifier. Do explicit cast to get rid of warning.
2016-10-06 12:59:13 +02:00
Daniel Kochmański
0badafcd35
multiprocessing: add predicate "mp:holding-lock-p"
...
This predicate returns T if lock is hold by the process and NIL if it is
hold by another process or is released.
2016-10-05 13:42:45 +02:00
Daniel Kochmański
11e35ea5b9
windows: gc: remove spurious define
...
Older bdwgc didn't export that symbol, so ECL patched that definition
for its own threaded needs. bdwgc has improved since then and our own
definition breaks CC builds. Fixes #288 .
See https://gitlab.com/embeddable-common-lisp/ecl/issues/288
2016-09-16 11:03:44 +02:00
Fabrizio Fabbri
1e5e86c1d2
Fix on several minor issue on thread.
...
- fix #262 to manage CTRL+c on Win.
- unregistered thread are left registered and enviroment not cleanup.
- manage when a finalizer is invoked before a valid enviroment is available.
2016-08-23 15:28:23 -04:00
Walter Genovese
67b2000ac6
MSVC fix ecl_import_current_thread
...
* Do not close thread handler until the thread is unregistered otherwise
the thread wakeup using QueueUserAPC will not work.
2016-05-12 13:09:53 -04:00
Fabrizio Fabbri
ca2a0c91e6
Fix import thread
2016-05-12 13:09:52 -04:00
Daniel Kochmański
5e8ec11bdd
cosmetic: fix indent (rest of C)
2016-05-06 08:41:52 +02:00
Denis Martinez
2b8bfc2825
fix a minor typo
2015-09-07 15:27:06 +02:00
Daniel Kochmański
0d25eccfb8
regression: add back removed interfaces
...
Adds back ecl_import_current_thread and ecl_release_current_thread.
Closes #8 .
Signed-off-by: Daniel Kochmański <daniel@turtleware.eu>
2015-09-04 21:29:08 +02:00
Matthew Mondor
8f07cd58d8
The ECL code no longer uses tabulator characters, they were replaced
...
by spaces.
A custom script was used to insert/replace Emacs and ViM per-file editor
settings according to their type and the new ECL coding style.
2015-09-03 07:35:47 -04:00
Matthew Mondor
5e43ec8789
Implement a few non-blocking MP functions:
...
MP:TRY-GET-SEMAPHORE
returns NIL if the semaphore could not be obtained, or the count
if it could be obtained
MP:MAILBOX-TRY-READ
returns a message if it's available, NIL if the queue is empty
MP:MAILBOX-TRY-SEND
returns the sent message if it could be queued, or NIL
(mailbox is full)
2015-08-26 12:31:19 -04:00
Daniel Kochmański
2f869e6eb6
windows: when using msvc, don't handle interrupts
...
Installed spawning process was broken and unimportant. ECL ignores C-c
interrupt and passes forward all the others when build with
msvc. Fixes #8 .
Signed-off-by: Daniel Kochmański <daniel@turtleware.eu>
2015-08-21 19:43:27 +02:00
Daniel Kochmański
4d19a27424
cosmetic: untabify
...
Signed-off-by: Daniel Kochmański <dkochmanski@turtle-solutions.eu>
2015-06-21 14:38:20 +02:00
Juan Jose Garcia Ripoll
94b37a8ab6
Missing use of ECL_NO_TL_BINDING in process.d
2013-05-24 21:33:06 +02:00
Juan Jose Garcia Ripoll
c5d7b4c960
The value of *CURRENT-PROCESS* must be bound by ecl_import_current_thread().
2012-11-09 22:20:01 +01:00
Juan Jose Garcia Ripoll
4a4c2289d7
Allow using a preinstalled copy of libatomic-ops
2012-10-31 21:42:10 +01:00
Juan Jose Garcia Ripoll
e6038ce113
Use the garbage collector routines to get the stack base in a more accurate way
2012-10-31 20:50:30 +01:00
Juan Jose Garcia Ripoll
42f0b2eaa5
Fixed problems in ecl_register_current_thread(). First, allocation of environment and process structures could not proceed when ecl_process_env() did not return a valid environment. Second, we can only call GC_unregister_my_thread() when the thread was not created by the garbage collector itself, for which we must inspect the output of GC_register_my_thread()
2012-09-27 23:06:56 +02:00
Juan Jose Garcia Ripoll
7a4a98d020
The owner of a lock now passes ownership to the first waiting process.
2012-07-30 22:49:56 +02:00
Juan Jose Garcia Ripoll
14d2960135
Use a spinlock for a thread wait until its process structure is completed by its parent. Rename waiting_for to woken_up for the real application it has.
2012-07-30 22:11:50 +02:00
Juan Jose Garcia Ripoll
0bc0dcf523
Remove statements that attempted at prioritizing the waiting queue and a bogus optimization that layed outside the appropriate locks
2012-07-29 22:03:32 +02:00
Juan Jose Garcia Ripoll
7638ca49ab
Sacrifice fairness from the wait queue because otherwise we miss events.
2012-07-28 00:11:15 +02:00
Juan Jose Garcia Ripoll
52f6efc2a0
Fixed typo in process.d
2012-07-22 22:12:57 +02:00
Juan Jose Garcia Ripoll
23d5394a2e
When a condition variable is signaled, it does not suffice to wakeup the process: we have to remove it. This is so because two consecutive calls to condition-variable-signal must delete two different processes.
2012-07-13 23:46:14 +02:00
Juan Jose Garcia Ripoll
9287a516ff
Yet another iteration for condition variables: now the lock is only released only once the thread has been added to the queue.
2012-07-13 21:35:38 +02:00
Juan Jose Garcia Ripoll
595f3dbe58
The previous implementation of condition variables was wrong: it assumed that the signaling thread did not own the lock.
2012-07-11 00:06:33 +02:00
Juan Jose Garcia Ripoll
e54d9a6173
Rename type_of -> ecl_t_of
2012-07-05 23:07:34 +02:00
Juanjo Garcia-Ripoll
9d4a68897a
Fixed typo in process.d
2012-07-03 11:18:45 +02:00
Juan Jose Garcia Ripoll
e1fb39a49b
Changed the name of the macro ECL_RESTARTS_TRY to ECL_RESTART_CASE
2012-07-02 23:21:34 +02:00
Juan Jose Garcia Ripoll
84a3200a02
Implemented a simple variant of RESTART-CASE in C. Used it to bind the restart ABORT on every thread. Introduced the function ecl_setq()
2012-07-02 22:49:27 +02:00
Juan Jose Garcia Ripoll
825fc8cbd3
Cnil and Ct are now part of legacy
2012-06-30 23:01:40 +02:00
Juan Jose Garcia-Ripoll
efadef99dc
Prefix the block creation macros, ECL_BLOCK_*, etc
2012-06-30 12:01:44 +02:00
Juan Jose Garcia-Ripoll
05a16801ca
Rename cl_va_* macros to ecl_va_*
2012-06-24 20:46:55 +02:00
Juan Jose Garcia Ripoll
52512c15a4
Rename the stp_* and aet_* enumeration names with the ecl_ prefix
2012-06-08 00:12:48 +02:00
Juan Jose Garcia Ripoll
cb1cf92713
Rename ecl_fix() to ecl_fixnum(), just like ecl_long_float() or ecl_double_float()
2012-06-07 23:55:43 +02:00
Juan Jose Garcia Ripoll
64a9168434
CHARACTERP, BASE_CHAR_P, BASE_CHAR_CODE_P, CODE_CHAR, CHAR_CODE, REAL_TYPE, IMMEDIATE, IMMEDIATE_TAG, FIXNUM_TAG, FIXNUM_MINUSP, FIXNUM_PLUSP, FIXNUMP and fix get the ecl_ prefix
2012-06-06 11:19:55 +02:00
Juan Jose Garcia Ripoll
2fc1f35b51
Mingw has sched.h but does not work
2012-05-09 23:15:02 +02:00
Juan Jose Garcia Ripoll
fb9c491a4f
In atomic.d, include ecl_atomics.h only when needed.
2012-04-19 21:15:32 +02:00
Juanjo Garcia-Ripoll
57cd6e3066
Minor changes to add the new MP objects to the MSVC port and new code for waking up processes in this platform.
2012-04-16 23:35:40 +02:00
Juan Jose Garcia Ripoll
d93cefad6e
Thanks to the chained wakeup event, ecl_wakeup_waiters() does no longer need an extra argument
2012-04-15 23:22:22 +02:00
Juan Jose Garcia Ripoll
d6f806af2c
Update description of ecl_wait_on().
2012-04-15 23:08:56 +02:00
Juan Jose Garcia Ripoll
323822457c
In the queue, when the first process of the queue leaves it, it awakes the next one in line to test its condition.
2012-04-15 22:48:33 +02:00
Juan Jose Garcia Ripoll
0ce91a565d
The mailbox did not set its mask properly
2012-04-15 20:39:09 +02:00