Commit graph

123 commits

Author SHA1 Message Date
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
Juan Jose Garcia Ripoll
a20b8b9218 ecl_wakeup_waiters now take an argument with the number of processes to awake 2012-04-15 11:09:42 +02:00
Juan Jose Garcia Ripoll
94c86a0af1 Simplified ecl_wait_on(): optimized detection of being first one and abortion, waking up is done with the lock held, woken up threads are not removed from queue. 2012-04-14 11:43:39 +02:00
Juan Jose Garcia Ripoll
51ca6d006e Simplify ecl_wakeup_waiters() 2012-04-12 23:59:34 +02:00
Juan Jose Garcia Ripoll
e3a426896f The process list is now protected by a spinlock 2012-04-12 23:59:20 +02:00
Juan Jose Garcia Ripoll
fbd3587b1a Removed further warnings about uninitialized or unused variables and functions 2012-04-11 23:04:27 +02:00
Juan Jose Garcia Ripoll
3bbba10703 Block interrupts when exiting the thread. 2012-04-11 22:03:25 +02:00
Juan Jose Garcia Ripoll
036cb55928 Fixes to remove warnings about unused variables. Replaced some uses of @(return) with ecl_return*() 2012-04-10 23:20:40 +02:00
Juan Jose Garcia Ripoll
4c4b58c5cf Fixed various type warnings issued by Clang 2012-04-09 22:31:09 +02:00
Juan Jose Garcia Ripoll
d33fa59ee4 Immediately register the process with the env it forms part of. 2012-04-08 15:19:06 +02:00
Juan Jose Garcia Ripoll
f03bb29cd9 Ensure that a process is listed when its environment is created, so that this environment is marked. 2012-04-08 12:29:34 +02:00