Juan Jose Garcia Ripoll
511d3b1945
src/c/hash.d: conditionalize another use of hash.lock.
2009-10-01 12:48:02 +02:00
Juan Jose Garcia Ripoll
5618cc648b
src/c/threads.d: we cannot create locks until the environment is set up
2009-10-01 11:36:34 +02:00
Juan Jose Garcia Ripoll
3913c4464e
Functions returning "void" can not use "return something" in Sun's compiler, even if that something is (void).
2009-09-29 21:31:02 +02:00
Juan Jose Garcia Ripoll
d498548b07
src/c/package.d: field hash.lock is not defined in single-threaded versions
2009-09-29 17:04:34 +02:00
Juan Jose Garcia Ripoll
04c7b4e67b
threads_mutex.d was not added in the previous commit
2009-09-27 21:52:04 +02:00
Juan Jose Garcia Ripoll
d3ce2ef931
Split the code for mutexes into a separate file and use these lock objects in cl_core, instead of the raw versions.
2009-09-27 21:20:01 +02:00
Juan Jose Garcia Ripoll
037cc67c48
Sometimes file_listen() returns that there exist characters, but actually there is an EOF.
2009-09-27 21:19:16 +02:00
Juan Jose Garcia Ripoll
500f324754
Following SBCL, use a single global lock for packages, instead of one lock per package.
2009-09-27 13:19:30 +02:00
Juan Jose Garcia Ripoll
dc6d0659b2
ecl_extend_hashtable() now does not destructively modify a package hash table. Instead, it returns a new object. This affects ecl_sethash() and all package functions that modify the package tables.
2009-09-27 10:46:54 +02:00
Juan Jose Garcia Ripoll
95f98db71c
When we are using an alternative stack for processing SIGSEGV, we cannot execute arbitrary lisp code there -- instead, jump to the outermost prompt.
2009-09-25 18:44:15 +02:00
Juan Jose Garcia Ripoll
c36eb22e73
Stack overflows now jump to the outermost toplevel.
2009-09-25 17:45:34 +02:00
Juan Jose Garcia Ripoll
5f2e473d36
Remove debug statements from last commit
2009-09-25 16:59:36 +02:00
Juan Jose Garcia Ripoll
f8817cda45
SIGSEGV and SIGBUS must be handled synchronously.
2009-09-25 16:58:55 +02:00
Juan Jose Garcia Ripoll
ac8b96db2b
We can only wait for the signals that have been blocked, not for SIGUSR1, SIGUSR2, etc.
2009-09-24 19:45:12 +02:00
Juan Jose Garcia Ripoll
bdf8d9d037
Initial version of semaphores both for POSIX and Windows. Includes test that detects failure of unnamed semaphores under Darwin. The whole code is still inactive.
2009-09-23 23:52:47 +02:00
Juan Jose Garcia Ripoll
cc052cb792
Added two new functions mp:lock-mine-p and mp:lock-count-mine which are used to implement mp:with-lock
2009-09-23 22:25:57 +02:00
Juan Jose Garcia Ripoll
9c416fbaa1
wakeup_function() only has to be defined under Windows.
2009-09-23 22:19:40 +02:00
Juan Jose Garcia Ripoll
1e12ead719
The routines that wait on condition variables should verify that the
...
calling thread owns the lock and then mark it as released, at least
for the duration of pthread_count_timedwait().
2009-09-22 22:32:09 +02:00
Juan Jose Garcia Ripoll
a943df3c5f
In cl_get_lock(), compute own_process early, so that we do not cause an interrupt
...
by accessing ecl_env (A. Gavrilov).
2009-09-22 22:18:22 +02:00
Juan Jose Garcia Ripoll
78e9859bd2
Code to implement mp:interrupt-process in Windows:
...
* unixint.d: capture exceptions caused by page guards.
* unixint.d: to interrupt a Windows thread, set up a page guard onto the
ECL environment and in addition queue an APC call that accesses the
environment to trigger that exception.
* stacks.h: CL_CATCH_ALL uses _try/_except to enforce ECL's exception
handler. Without it, Windows behaves randomly and sometimes uses the
default handler and sometimes it simply aborts.
* threads.d: we use ordinary handlers to identify threads.
* time.d: SLEEP now uses Windows' SleepEx, leaving the thread in an
alertable state -- that is, it can be interrupted.
* top.lsp: fixed and improved the code that handles console interrupts,
by first using ordinary conditions and then using an interactive
query function to decide which process to interrupt.
2009-09-22 20:13:23 +02:00
Juan Jose Garcia Ripoll
161926ac93
Solved some problem with the queueing of signals and added preliminary code for MP:INTERRUPT-PROCESS using Windows page guards.
2009-09-20 21:53:02 +02:00
Juan Jose Garcia Ripoll
80cf4ea148
Fixed a few typos in the implementation of Windows interrupts.
2009-09-19 00:48:17 +02:00
Juan Jose Garcia Ripoll
2661b663ae
New interrupt handling model:
...
* threads.d: New code to suspend and resume processes.
* threads.d: Threads are created detached with more robust code to wait
for completion.
* top.lsp: New code for handling console interrupt (Ctrl-C) allows
selectively interrupting one or more processes or continuing.
* file.d: Console streams are created in non-locking mode when needed.
* load.lsp.in: mp.lsp is always loaded.
* mp.lsp, symbols_list*: without-interrupts and the like belong in EXT
not in MP package.
2009-09-18 23:02:56 +02:00
Juan Jose Garcia Ripoll
1bba5bab7c
Document the rationale behind how we handle interrupts.
2009-09-16 22:30:59 +02:00
Juan Jose Garcia Ripoll
70287ee9c5
Implement missing EXT:WITH-INTERRUPTS
2009-09-16 22:30:16 +02:00
Juan Jose Garcia Ripoll
50c10a5d8d
We have to restore the signal before jump_to_sigsegv_handler()
2009-09-16 20:45:15 +02:00
Juan Jose Garcia Ripoll
e647d62b33
unixint.d:
...
* The code that decides whether to process or queue a signal is factored into
handle_or_queue. This code is now used by both Linux and Windows handlers.
* Each Linux or Windows handler translates the signal into a lisp object that
is passed to handle_or_queue. This allows for simpler, platform independent
queueing, and in particular it enables Windows to discriminate FPE errors.
2009-09-15 23:45:51 +02:00
Juan Jose Garcia Ripoll
90ef6e70ef
unixint.d:
...
* The routine handle_fpe_signal() is embedded in the lisp_signal_handler
* The Windows signal handler falls back to the previously installed handler
for exceptions that are not to be handled.
2009-09-15 21:59:58 +02:00
Juan Jose Garcia Ripoll
9d49df3a27
unixfsys.d: removed a debug statement that prints the DLL location.
2009-09-15 16:11:51 +02:00
Juan Jose Garcia Ripoll
260853ef0a
QUIT now unwinds all forms before exiting. In addition it can kill all existing threads.
2009-09-13 20:46:21 +02:00
Juan Jose Garcia Ripoll
a43206af76
Back to using locking streams for I/O in multithreaded environments.
2009-09-13 19:25:44 +02:00
Juan Jose Garcia Ripoll
c61975728a
Avoid using C streams for the standard input when using threads.
2009-09-13 19:25:44 +02:00
Juan Jose Garcia Ripoll
74c8ce560c
The console is now protected by a global lock, so that toplevels from different threads do not interfere each other.
2009-09-13 19:25:44 +02:00
Juan Jose Garcia Ripoll
31a2348110
threads.d: fixed typos in the definition of mp_restore_signals.
2009-09-13 19:25:43 +02:00
Juan Jose Garcia Ripoll
2b9b19b669
New functions MP:BLOCK/RESTORE-SIGNALS block signals in a thread-local fashion whenever possible.
2009-09-13 19:25:43 +02:00
Juan Jose Garcia Ripoll
1cac2fcb4f
MP:PROCESS-JOIN was defined also in not threaded builds
2009-09-09 11:58:57 +02:00
Juan Jose Garcia Ripoll
bb15e28d00
Create threads in a joinable state (Unix pthread) and let it detach itself before exiting.
2009-09-08 15:32:30 +02:00
Juan Jose Garcia Ripoll
83d8c5e3d5
The function mp_process_join() now also works with Windows.
2009-09-08 14:46:42 +02:00
Juan Jose Garcia Ripoll
ffbb1b45ad
New function MP:PROCESS-JOIN, waits for a thread to terminate (J.C.Beaudoin)
2009-09-08 14:32:49 +02:00
Juan Jose Garcia Ripoll
5c6218f2e1
Note last change. Move *allow-with-interrupts* to MP package.
2009-09-05 12:49:41 +02:00
Juan Jose Garcia Ripoll
723c9419b4
Fixed typo in mp:get-lock
2009-09-05 12:49:01 +02:00
Juan Jose Garcia Ripoll
99c98f82e2
src/c/compiler.d: asm_end() now always sets the value of bytecodes.definition
2009-09-05 12:43:36 +02:00
Juan Jose Garcia Ripoll
8b57696625
Fixed a couple of typos in ecl_set_finalizer_unprotected().
2009-09-05 12:31:11 +02:00
Juan Jose Garcia Ripoll
88f663ddb6
* Symbol SI:*INTERRUPT-DISABLE* changes name to SI:*INTERRUPTS-DISABLED*.
...
* Implement WITHOUT-INTERRUPTS similarly to SBCL.
* Implement WITH-LOCK disabling interrupts in the lock release phase.
2009-09-05 12:14:10 +02:00
Juan Jose Garcia Ripoll
436657ea2a
We do not need error checking mutexes, as we can do the recursivity check ourselves.
2009-09-05 11:31:21 +02:00
Juan Jose Garcia Ripoll
f360f6b0f0
Reorganize mp:make-lock so that it is interrupt-safe.
2009-09-05 10:42:17 +02:00
Juan Jose Garcia Ripoll
a35ba14206
Create ecl_set_finalizer_unprotected() for situations in which a finalizer must be set with interrupts disallowed.
2009-09-05 10:41:59 +02:00
Juan Jose Garcia Ripoll
ca6198d753
Reimplement with-lock so that it is interrupt-safe.
2009-09-04 23:12:36 +02:00
Juan Jose Garcia Ripoll
d60c758832
CLASS-OF now works with weak pointers.
2009-09-03 16:57:04 +02:00
Juan Jose Garcia Ripoll
00a5b33e01
Weak pointers can now be printed.
2009-09-03 16:55:33 +02:00